{"record":{"id":"c3b1474eda67b36a","repo":"astrid-runtime/astrid","slug":"capsule-content-cannot-contain-a-directory-symlink","errorCode":null,"errorMessage":"capsule content cannot contain a directory symlink: {}","messagePattern":"capsule content cannot contain a directory symlink: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/artifact.rs","lineNumber":474,"sourceCode":"    let mut entries = std::fs::read_dir(current)\n        .with_context(|| format!(\"failed to read capsule directory {}\", current.display()))?\n        .collect::<Result<Vec<_>, _>>()?;\n    entries.sort_unstable_by_key(std::fs::DirEntry::file_name);\n    for entry in entries {\n        let path = entry.path();\n        let file_type = entry.file_type()?;\n        if file_type.is_symlink() {\n            let resolved = std::fs::canonicalize(&path)\n                .with_context(|| format!(\"failed to resolve capsule symlink {}\", path.display()))?;\n            if !resolved.starts_with(canonical_root) {\n                bail!(\n                    \"capsule symlink resolves outside its source tree: {}\",\n                    path.display()\n                );\n            }\n            let metadata = std::fs::metadata(&resolved)?;\n            if !metadata.is_file() {\n                bail!(\n                    \"capsule content cannot contain a directory symlink: {}\",\n                    path.display()\n                );\n            }\n            let relative = path.strip_prefix(root)?;\n            let normalized = normalize_relative_path(relative)?;\n            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()","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/artifact.rs#L456-L492","documentation":"Fired by collect_directory_records when a symlink inside the capsule resolves to a directory. Only symlinks to regular files are permitted, since directory symlinks would bypass per-file content verification.","triggerScenarios":"Thrown at crates/astrid-build/src/artifact.rs:474 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the directory symlink and place the directory contents physically in the tree","Rebuild the capsule flattening the symlink","Point the capsule at a fixed snapshot of the directory"],"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"}