gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
17.26k stars 715 forks source link

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

Closed CrowdHailer closed 1 month ago

CrowdHailer commented 5 months ago

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.

lpil commented 5 months ago

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

zahash commented 4 months ago

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?

CrowdHailer commented 4 months ago

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

zahash commented 4 months ago

@CrowdHailer

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

lpil commented 4 months ago

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

zahash commented 4 months ago

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

zahash commented 4 months ago

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