{"record":{"id":"ee9236698393cd5d","repo":"pbakaus/impeccable","slug":"ambiguous-snapshot-slug-use-an-explicit-path-or","errorCode":null,"errorMessage":"ambiguous snapshot slug; use an explicit ./path or remove the local name collision\n","messagePattern":"ambiguous snapshot slug; use an explicit \\./path or remove the local name collision\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/critique_storage.rs","lineNumber":573,"sourceCode":"            else {\n                return 2;\n            };\n            let mut latest =\n                read_newest_snapshot_for_identity_slugs(&slugs, target_identity.as_deref(), &cwd, &env);\n            if latest.is_none() && !ready_slug {\n                // Identity-less snapshots are safe only under the new/current\n                // collision-resistant slug. A pre-hash slug suffix alone cannot\n                // prove which long target owned the historical snapshot.\n                latest = slugs.first().and_then(|slug| read_newest_snapshot_for_identity(slug, None, &cwd, &env));\n            }\n            let latest = latest.unwrap_or(newest_for_slug);\n            if meta_closed(&latest) {\n                return 2;\n            }\n            let recorded_target_identity = snapshot_target_identity(&latest);\n            let matching_identity = recorded_target_identity == target_identity;\n            if ready_slug && target_path.as_deref().map(exists).unwrap_or(false) && !matching_identity {\n                io.err(\"ambiguous snapshot slug; use an explicit ./path or remove the local name collision\\n\");\n                return 2;\n            }\n            let concrete_target = !ready_slug || matching_identity;\n            if concrete_target && recorded_target_identity.is_some() && !matching_identity {\n                return 2;\n            }\n            let concrete_local_target = concrete_target && target_path.is_some();\n            if concrete_local_target {\n                let recorded_fp = match latest.meta.get(\"target_fingerprint\") {\n                    Some(Value::String(s)) => Some(s.clone()),\n                    _ => None,\n                };\n                // JS strict `!==`: equal only when both are the same string;\n                // undefined/null on either side always differ.\n                let differ = !matches!((&recorded_fp, &target_fingerprint), (Some(a), Some(b)) if a == b);\n                if differ {\n                    return match close_snapshot(&latest.path, &cwd, &env) {\n                        Err(e) => {","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/critique_storage.rs#L555-L591","documentation":"`latest` refuses to answer when the argument is a short 'ready slug' while a local path of that name also exists on disk, and the newest snapshot's recorded target identity does not match the local target's identity — the slug is ambiguous, so the command prints this message and exits 2 without closing or returning a possibly-wrong snapshot.","triggerScenarios":"Calling `critique-storage latest mypage` when both a snapshot for slug `mypage` exists AND a file/directory named `mypage` exists in the cwd, and the snapshot was recorded against a different target identity (e.g. the local `mypage` was recreated or points elsewhere).","commonSituations":"A target file was deleted and recreated under the same short name, the cwd changed so a same-named local file now shadows the slug, or snapshots exist from an older project sharing the slug.","solutions":["Disambiguate by passing the explicit local path with `./` prefix: `latest ./mypage`.","Remove or rename the local file that collides with the snapshot slug.","If the local target is the one you mean, recreate/overwrite the snapshot via `write` so its recorded identity matches.","Use the fully resolved path form of the target instead of the short slug."],"exampleFix":"// before\nlatest mypage\n// ambiguous: local ./mypage exists with different identity\n// after\nlatest ./mypage","handlingStrategy":"validation","validationCode":"const localName = target.replace(/^\\.\\//, '');\nif (!target.startsWith('./') && fs.existsSync(localName)) {\n  target = './' + localName; // disambiguate short slug from local file\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer explicit `./path` targets over short slugs when a same-named local file may exist.","Re-snapshot a target after recreating it so identities match.","Keep one project per working directory to avoid slug collisions.","Treat exit code 2 as 'no usable snapshot' and write a fresh one."],"tags":["cli","ambiguity","snapshot","slug"],"backgroundTag":"entity-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}