Rust E0425 "cannot find value in this scope" in CI
rustc found an identifier used as a value that does not name any binding, constant, or function in scope. The name is misspelled, never declared, or only exists under a feature that is off.
What this error means
The build fails with error[E0425]: cannot find value foo in this scope pointing at the use site. It reproduces every run from the same source.
cargo
error[E0425]: cannot find value `max_retries` in this scope
--> src/run.rs:12:17
|
12 | for _ in 0..max_retries {
| ^^^^^^^^^^^ not found in this scope
|
help: a local variable with a similar name exists: `max_retry`Common causes
Typo or undeclared binding
The value name does not match any let, const, static, or function in scope -- usually a spelling slip or a binding removed in a refactor.
Feature-gated constant or function
A const or fn compiled only under a Cargo feature is invisible when CI builds without that feature.
How to fix it
Use the name the compiler suggests
- Check the
help: a local variable with a similar name existshint for the intended identifier. - Fix the typo, or declare the binding if it was never introduced.
- If the value is feature-gated, enable that feature in the CI build.
src/run.rs
let max_retries = 3;
for _ in 0..max_retries { /* ... */ }Match the CI feature flags
Confirm the value is not hidden behind a feature your local default build enables.
Terminal
cargo check --no-default-features --features ci --lockedHow to prevent it
- Run
cargo checkacross the same feature sets CI uses. - Enable editor rust-analyzer diagnostics so unresolved values surface before commit.
- Avoid feature-gating identifiers referenced from non-gated code.
Related guides
Rust E0412 "cannot find type in this scope" in CIFix rust E0412 "cannot find type `X` in this scope" in CI -- a missing `use`, a typo in the type name, or a t…
Rust "error[E0433]: failed to resolve" in CIFix Rust "error[E0433]: failed to resolve: use of undeclared crate or module" in CI - a missing dependency, m…
Rust "unused variable" Denied as Error (-D warnings) in CIFix Rust builds where "unused variable" (or other lints) fail CI under -D warnings / deny(warnings) -- the wa…