{"id":"512a24ce74b036c2","repo":"rust-lang/rust","slug":"error-a-dep-graph-node-kind-does-not-have-a","errorCode":null,"errorMessage":"Error: A dep graph node ({kind:?}) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.\nDepNode: {node:?}","messagePattern":"Error: A dep graph node \\((.+?)\\) does not have an unique index\\. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting\\. A clean build may also work around the issue\\.\nDepNode: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_middle/src/dep_graph/serialized.rs","lineNumber":196,"sourceCode":"        nodes_by_kind: &[Option<SerializedDepNodeIndex>],\n        profiler: &Option<SelfProfilerRef>,\n    ) -> &UnhashMap<PackedFingerprint, SerializedDepNodeIndex> {\n        self.map.get_or_init(|| {\n            let _prof_timer = profiler\n                .as_ref()\n                .map(|p| p.generic_activity(\"incr_comp_load_dep_graph_reverse_index\"));\n            let range = (self.start as usize)..(self.start as usize + self.len as usize);\n            let mut map =\n                UnhashMap::with_capacity_and_hasher(self.len as usize, Default::default());\n            for &idx in &nodes_by_kind[range] {\n                let idx = idx.expect(\"counting sort fills every slot of a kind's range\");\n                let node = nodes[idx];\n                debug_assert_eq!(node.kind, kind);\n                if map.insert(node.key_fingerprint, idx).is_some()\n                    // Side effect nodes can legitimately share a fingerprint.\n                    && node.kind != DepKind::SideEffect\n                {\n                    panic!(\n                        \"Error: A dep graph node ({kind:?}) does not have an unique index. \\\n                         Running a clean build on a nightly compiler with \\\n                         `-Z incremental-verify-ich` can help narrow down the issue for reporting. \\\n                         A clean build may also work around the issue.\\n\n                         DepNode: {node:?}\"\n                    )\n                }\n            }\n            map\n        })\n    }\n}\n\nimpl SerializedDepGraph {\n    #[inline]\n    pub fn edge_targets_from(\n        &self,\n        source: SerializedDepNodeIndex,","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_middle/src/dep_graph/serialized.rs#L178-L214","documentation":"ICE raised while building the SerializedDepGraph reverse index (compiler/rustc_middle/src/dep_graph/serialized.rs:196) when two distinct DepNodes of the same DepKind produce the same key_fingerprint. The exception is DepKind::SideEffect, which is allowed to share fingerprints. For all other kinds, fingerprint uniqueness is a core invariant; a collision means hashing is non-deterministic or the graph is corrupt. The message recommends -Z incremental-verify-ich to localize the fault.","triggerScenarios":"Two different DepNodes of the same kind hash to the same PackedFingerprint during fingerprint_map construction, which happens lazily on first lookup of that kind. Caused by a non-stable hasher seed, a bug in the DepNode's StableHash impl, or a corrupt serialized graph that re-encodes two nodes with the same key.","commonSituations":"Bisecting rustc nightlies where StableHash of a query input changed; third-party tools that hand-craft query inputs; hardware/disk corruption silently flipping bits in the cached graph; running with RUSTC_RANDOMIZE_LAYOUT or unstable hashing knobs enabled.","solutions":["Do a clean build (cargo clean) — this is the documented workaround in the panic message itself and resolves most transient collisions.","Rebuild on a recent nightly with -Z incremental-verify-ich to catch the unstable fingerprint as it is produced and narrow down which query/DepNode is at fault.","Check for and disable any non-default hashing/randomization knobs (RUSTC_FORCE_INCREMENTAL, custom RUSTFLAGS touching hashing).","If reproducible after a clean build, file an ICE report against rustc with the DepNode printed in the message."],"exampleFix":"# before\ncargo build  # reusing a stale/cross-version incremental cache\n\n# after\ncargo clean && cargo +nightly build -Z incremental-verify-ich","handlingStrategy":"retry","validationCode":"// The message itself recommends a clean build on nightly with\n// -Z incremental-verify-ich. Pre-flight: wipe the cache and set\n// the verification flag.\nfn configure_verify_ich(cmd: &mut std::process::Command) {\n    let _ = std::fs::remove_dir_all(\"target/debug/incremental\");\n    cmd.args([\"-Z\", \"incremental-verify-ich\"]);\n}","typeGuard":null,"tryCatchPattern":"// Catch the panic, capture the offending DepNode from the message\n// for the bug report, then retry with a clean incremental cache.\nuse std::panic::{catch_unwind, AssertUnwindSafe};\n\nlet outcome = catch_unwind(AssertUnwindSafe(|| run_compiler_pass(tcx)));\nif outcome.is_err() {\n    let _ = std::fs::remove_dir_all(\"target/debug/incremental\");\n    // retry once; if it reproduces, file an ICE report with the DepNode details\n    run_compiler_pass(tcx);\n}","preventionTips":["Use -Z incremental-verify-ich on nightly to catch dep-node uniqueness issues early","Run cargo clean after switching rustc versions or updating dependencies","Report the ICE including the full DepNode printed in the message","Consider a clean build (no incremental) for release artefacts to avoid subtle miscompilations"],"tags":["rustc","incremental-compilation","dep-graph","fingerprint","ice"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}