{"id":"bc7d59411fb405bb","repo":"rust-lang/cargo","slug":"not-currently-active","errorCode":null,"errorMessage":"not currently active!?","messagePattern":"not currently active!\\?","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/resolver/mod.rs","lineNumber":898,"sourceCode":"                // A, B are both known bad states each that can never be activated.\n                // A + B is redundant but can't be activated, as if\n                // A + B is active then A is active and we know that is not ok.\n                for (_, other) in &others {\n                    con.extend(other.iter().map(|(&id, re)| (id, re.clone())));\n                }\n                // Now that we have this combined conflict, we can do a substitution:\n                // A dep is equivalent to one of the things it can resolve to.\n                // So we can remove all the things that it resolves to and replace with the parent.\n                for (other_id, _) in &others {\n                    con.remove(other_id);\n                }\n                con.insert(*critical_parent, backtrack_critical_reason);\n\n                if cfg!(debug_assertions) {\n                    // the entire point is to find an older conflict, so let's make sure we did\n                    let new_age = con\n                        .keys()\n                        .map(|&c| cx.is_active(c).expect(\"not currently active!?\"))\n                        .max()\n                        .unwrap();\n                    assert!(\n                        new_age < backtrack_critical_age,\n                        \"new_age {} < backtrack_critical_age {}\",\n                        new_age,\n                        backtrack_critical_age\n                    );\n                }\n                past_conflicting_activations.insert(dep, &con);\n                return Some(con);\n            }\n        }\n    }\n    None\n}\n\n/// Returns Some of the largest item in the iterator.","sourceCodeStart":880,"sourceCodeEnd":916,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/resolver/mod.rs#L880-L916","documentation":"Internal debug-only invariant assertion in Cargo's dependency resolver (src/resolver/mod.rs:898). While combining conflict maps during backtracking, the resolver builds a new ConflictMap and then asserts every key in it is still an active package in the current ResolverContext via cx.is_active(c).expect(\"not currently active!?\"). The whole block is wrapped in cfg!(debug_assertions), so it only fires in debug/test builds of cargo; in a release build the branch is dead and never executes. A panic here means the conflict-combining / parent-substitution logic recorded a conflict against a package that the resolver context no longer considers active.","triggerScenarios":"Running a debug build of cargo (or cargo's own test suite) against a dependency graph that forces the backtracking 'find an older conflict' optimization in find_candidate's sibling logic: multiple parents of a critical activation, where past_conflicting_activations.find(...) yields a combined conflict that, after substituting critical_parent, still references a package id whose is_active() returns None.","commonSituations":"Hacking on cargo itself with a dev build; running cargo resolver tests; a complex workspace with many conflicting semver requirements and yanked/publish-age-restricted crates that drive deep backtracking. Not reproducible with a stock release cargo from rustup.","solutions":["Reproduce with a release cargo build (e.g. `cargo build --release` of cargo) - the assertion is compiled into a dead branch there and will not fire; if resolution succeeds, you have confirmed it is the debug invariant being overly strict, not a real misresolution.","Reduce the failing Cargo.toml with `cargo repro` / manual minimization to the smallest dependency set that reproduces the panic and attach it to a rust-lang/cargo issue so the resolver bookkeeping bug can be fixed.","On a debug build, bisect cargo commits around the resolver / backtracking changes to find which change broke the invariant.","As a workaround for the graph itself, pin or loosen specific dependency versions so the conflict-combining path is not exercised."],"exampleFix":"// before: debug cargo panics on a messy graph\n//   RUSTFLAGS='' cargo run --build -j8   # dev profile => cfg!(debug_assertions) true\n//   thread 'main' panicked at src/resolver/mod.rs:898: not currently active!?\n\n// after: confirm with a release binary where the assertion is dead\n//   cargo build --release\n//   ./target/release/cargo build\n// then report the minimized repro to rust-lang/cargo.","handlingStrategy":"fallback","validationCode":"// Not guardable from caller code (internal resolver invariant).\n// Pre-check that you are not on a debug cargo build before relying on resolution:\nfn assert_release_cargo() {\n    // cfg!(debug_assertions) is false => the failing branch at mod.rs:894-907 is dead.\n    assert!(!cfg!(debug_assertions), \"this graph trips a debug-only resolver assertion; use a release cargo\");\n}","typeGuard":"// No type-level guard: PackageId / ConflictMap are internal to cargo.\n// Only narrowing available is 'is this a release binary?', which removes the panic site.","tryCatchPattern":"// Panics are not normally caught in cargo. If you embed cargo as a library,\n// isolate the resolving thread and catch_unwind to degrade gracefully:\nuse std::panic;\nlet result = panic::catch_unwind(|| {\n    // ... call into cargo's resolve ...\n});\nif result.is_err() {\n    // fall back to a release cargo or a simplified manifest; do NOT silently retry unchanged.\n}","preventionTips":["Run cargo from a release toolchain (rustup stable) for real resolutions; keep debug builds for hacking on cargo itself.","Keep dependency graphs reasonably constrained (avoid huge optional-dep matrices) to stay off the deep backtracking path.","When developing cargo, run the resolver test suite before trusting a local debug binary on a real workspace."],"tags":["resolver","backtracking","debug-assertion","cargo-internal","rust"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}