{"record":{"id":"cbc4438fed2837b6","repo":"astrid-runtime/astrid","slug":"capsule-directory-contains-duplicate-provenance","errorCode":null,"errorMessage":"capsule directory contains duplicate provenance","messagePattern":"capsule directory contains duplicate provenance","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/artifact.rs","lineNumber":499,"sourceCode":"            let mut file = File::open(&resolved)?;\n            records.push(hash_reader(normalized, metadata.len(), &mut file)?);\n            continue;\n        }\n        if file_type.is_dir() {\n            collect_directory_records(root, canonical_root, &path, records, envelope)?;\n            continue;\n        }\n        if !file_type.is_file() {\n            bail!(\n                \"capsule content contains a special file: {}\",\n                path.display()\n            );\n        }\n        let relative = path.strip_prefix(root)?;\n        let normalized = normalize_relative_path(relative)?;\n        if normalized == PROVENANCE_FILE {\n            if envelope.is_some() {\n                bail!(\"capsule directory contains duplicate provenance\");\n            }\n            *envelope = Some(std::fs::read(&path)?);\n            continue;\n        }\n        let mut file = File::open(&path)?;\n        let size = file.metadata()?.len();\n        records.push(hash_reader(normalized, size, &mut file)?);\n    }\n    Ok(())\n}\n\nfn normalize_relative_path(path: &Path) -> anyhow::Result<String> {\n    let mut parts = Vec::new();\n    for component in path.components() {\n        match component {\n            Component::Normal(part) => parts.push(\n                part.to_str()\n                    .context(\"capsule paths must be UTF-8\")?","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/artifact.rs#L481-L517","documentation":"Guard raised in collect_directory_records while walking the capsule content tree: two or more provenance entries for the same directory were found, meaning the provenance envelope records the same source more than once (e.g. duplicate include directives or repeated provenance sections). The walk aborts so the capsule's provenance attestation stays unambiguous. Called by verify_directory and recursively by itself.","triggerScenarios":"Thrown at crates/astrid-build/src/artifact.rs:499 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete stale or extra provenance files so exactly one envelope remains","Rebuild the capsule, which regenerates a single envelope","Determine which envelope is legitimate before removing the others"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}