Missing `type` attribute for a canister causes panic
Open
Nobody has claimed this yet.
needs-triage
- Dominant language
- Rust
- Stars
- 204
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Missing type attribute for a canister causes panic (should cause a regular error).
$ dfx start --background --clean && time dfx deploy -vv
Running dfx start for version 0.20.0-icsystemtest.0+rev256.f4913345
Using project-specific network 'local' defined in /home/porton/Projects/zondirectory2/dfx.json
Version v0.20.0-icsystemtest.0+rev256.f4913345 installed successfully.
Initialized replica.
Dashboard: http://localhost:36121/_/dashboard
Trace mode enabled. Lots of logs coming up.
Checking if identity 'default' exists.
Building dependencies graph.
thread 'main' panicked at src/dfx/src/lib/builders/motoko.rs:44:96:
called `Result::unwrap()` on an `Err` value: Failed to create <Type>CanisterInfo for canister 'frontend'.
Caused by:
`main` attribute is required on Motoko canisters in dfx.json
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)
real 0m15.212s
user 0m16.274s
sys 0m1.671s
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/dfx/src/lib/builders/motoko.rs at the reported line and reproduce the failure with dfx start --background --clean followed by dfx deploy -vv using a canister missing its type attribute. Replace the panic behavior with a regular error and verify that deployment reports the configuration problem without aborting from an unwrap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100