Rust: Unresolved import (E0432) - missing crate or module
error[E0432]: unresolved import `foo`
--> src/main.rs:1:5
|
1 | use foo::bar;
| ^^^ no `foo` in the root
Immediate Remediation
bash
cargo add foo
Root Cause Analysis
The import path `foo` does not resolve to any crate or module in the current crate's dependency graph or file system. This typically happens when a dependency is missing from Cargo.toml or a local module file is not created.
Verification & Guardrails
- If `foo` is a local module, create `src/foo.rs` instead of using `cargo add`.
- Run `cargo build` after adding the dependency to verify the import resolves.
- Check for typos in the import path and ensure the crate name matches the dependency name in Cargo.toml.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.