# How to rebuild toml files?

**URL:** <https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523>\
**Category:** General Usage\
**Created:** [December 6, 2024, 4:02am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523 "2024-12-06T04:02:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Vavasis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephen_vavasis/32/3389_2.png) [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Post date:** [December 6, 2024, 4:02am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/1 "2024-12-06T04:02:08Z")

</div>

My package under development has the file structure `MyPackage/src` and `MyPackage/examples`. My development process has been:

```julia
julia> using Revise
pkg> dev .
pkg> activate ./examples
julia> include("./examples/first_example.jl")

```

which used to work, but now Revise has started giving error messages like:

```julia
ERROR: LoadError: failed to find source of parent package: <some name of a dependent package>

```

I am thinking that the toml files may have been corrupted, so I would like to delete them and start over. I was hoping to use `] generate MyPackage` to generate new toml files, but this does not work because the package manager wants to create a new directory structure with `MyPackage` and `MyPackage/src` rather than reuse my existing directories that are populated with my code. So the question is: what command can I use to re-initialize the toml files? Or is there a better way to clear this error from Revise?

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [December 6, 2024, 4:07am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/2 "2024-12-06T04:07:33Z")

</div>

So examples has it’s own Project.toml file? Maybe something is outdated/out-of-sync? You could try running `]resolve` after environment activation to have Pkg check the dependencies. Maybe also try `]precompile` (but I think `resolve` triggers precompilation if it’s necessary).

I don’t know what causes the error from Revise though. Never seen it before.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 6, 2024, 8:33am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/3 "2024-12-06T08:33:36Z")

</div>

I think it would very rarely be the best way to solve a problem but if you have to reset a `Project.toml` file, open it in an editor and remove everything after the first section. This keeps the identity of a package/project but removes all dependencies, etc.

To reset a `Manifest.toml` file, simply delete it and let Pkg regenerate it. This is a much more useful operation and frequently the best resolution if you have a merge conflict in the Manifest.

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [December 6, 2024, 8:48am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/4 "2024-12-06T08:48:58Z")

</div>

> [@GunnarFarneback](#):
>
> To reset a `Manifest.toml` file, simply delete it and let Pkg regenerate it. This is a much more useful operation and frequently the best resolution if you have a merge conflict in the Manifest.

I think `]resolve` basically does that. There is an important difference on earlier Julia versions if you have packages that are not in General. This information was stored exclusively in Manifest.toml and thus it could not be regenerated from Project.toml alone. Since 1.11 Project.toml can contain a `[sources]` section tracks the foreign locations, so Manifest.toml probably can be regenerated nowadays.  
Still I think `]resolve` is the better way generally. But I don’t know exactly what is ment by “a merge conflict in the Manifest”.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 6, 2024, 9:10am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/5 "2024-12-06T09:10:55Z")

</div>

With a merge conflict I mean the result you get if you do a `git merge` of two branches with diverging updates of `Manifest.toml`.

`]resolve` is less powerful than deleting the Manifest if you have managed to get into an inconsistent state. E.g. try to remove an arbitrary dependency entry in `Manifest.toml` and see how unhappy `Pkg` becomes.

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [December 6, 2024, 9:26am UTC](https://discourse.julialang.org/t/how-to-rebuild-toml-files/123523/6 "2024-12-06T09:26:34Z")

</div>

Thanks for explaining 🙂 I never had that happen to me ever so just tried it and have to agree that in this case there seems no other way then to delete the Manifest. Good to keep in mind in case it happens to me in the future.
