gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Show a helpful error when manifest.toml has been edited to be invalid

Open CrowdHailer opened this issue 1 year ago • 7 comments

I'm doing some merging of branches and got this. I got a merge conflict in the manifest file and just took one branches with the hope of being able to run gleam add.

$ (cd eyg; GLEAM_LOG=trace gleam add glexer)
DEBUG download_deps: locking_build_directory path="/home/peter/Projects/project_wisdom/eyg/build/packages"
TRACE download_deps: reading_file path="/home/peter/Projects/project_wisdom/eyg/gleam.toml"
DEBUG download_deps: reading_manifest_toml
TRACE download_deps: reading_file path="/home/peter/Projects/project_wisdom/eyg/manifest.toml"
DEBUG download_deps: manifest_outdated
  Resolving versions
error: Fatal compiler bug!

This is a bug in the Gleam compiler, sorry!

Please report this crash to https://github.com/gleam-lang/gleam/issues/new
and include this error message with your report.

Panic: compiler-core/src/config.rs:276
	Package fresh but not in manifest
Gleam version: 1.0.0
Operating system: linux

If you can also share your code and say what file you were editing or any
steps to reproduce the crash that would be a great help.

You may also want to try again with the `GLEAM_LOG=trace` environment
variable set.

p.s. running gleam update first fixed the issue. but I still though worth reporting as the compiler told me too.

CrowdHailer avatar Mar 23 '24 11:03 CrowdHailer

Thank you. Let's raise some more useful error message when the manifest has been edited to be invalid.

lpil avatar Mar 25 '24 14:03 lpil

i can find the location where the code panics but i can't recreate the bug. Can @CrowdHailer pls give the minimal steps on how to recreate the bug in a new project?

zahash avatar Apr 05 '24 13:04 zahash

unfortunately I'm not able to recreate in a new project.

CrowdHailer avatar Apr 07 '24 06:04 CrowdHailer

@CrowdHailer

Can you paste the contents of the manifest.toml and gleam.toml when the error occurs?

zahash avatar Apr 07 '24 07:04 zahash

He doesn't have them any more and doesn't know how to make it happen again.

You could try removing some of the entries from the manifest perhaps

lpil avatar Apr 07 '24 10:04 lpil

ok, i'm able to recreate the bug. will make a PR soon.

zahash avatar Apr 07 '24 12:04 zahash

@lpil here is the PR https://github.com/gleam-lang/gleam/pull/2913

zahash avatar Apr 07 '24 13:04 zahash