{"record":{"id":"a983f921eb623776","repo":"astrid-runtime/astrid","slug":"legacy-capsule-entry-has-no-name","errorCode":null,"errorMessage":"legacy capsule entry has no name","messagePattern":"legacy capsule entry has no name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/storage.rs","lineNumber":697,"sourceCode":"            );\n        }\n        let source = home.wit_store_dir().join(format!(\"{hash}.wit\"));\n        let destination = staging.path().join(\"wit\").join(relative);\n        if let Some(parent) = destination.parent() {\n            fs::create_dir_all(parent)?;\n        }\n        fs::copy(&source, &destination)\n            .with_context(|| format!(\"restore content-addressed WIT blob {hash}\"))?;\n    }\n    canonical_capsule_archive(staging.path())\n}\n\nfn copy_legacy_tree(source: &Path, destination: &Path) -> anyhow::Result<()> {\n    fs::create_dir_all(destination)?;\n    for (path, metadata) in read_dir_sorted(source)? {\n        let relative = path\n            .file_name()\n            .ok_or_else(|| anyhow::anyhow!(\"legacy capsule entry has no name\"))?;\n        let destination = destination.join(relative);\n        if metadata.file_type().is_symlink() {\n            bail!(\"legacy capsule contains symlink {}\", path.display());\n        }\n        if metadata.is_dir() {\n            copy_legacy_tree(&path, &destination)?;\n        } else if metadata.is_file() {\n            let name = path.file_name().and_then(|name| name.to_str());\n            if matches!(name, Some(\"meta.json\" | \"authority.json\" | \".env.json\")) {\n                continue;\n            }\n            fs::copy(path, destination)?;\n        } else {\n            bail!(\"legacy capsule contains special file {}\", path.display());\n        }\n    }\n    Ok(())\n}","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/storage.rs#L679-L715","documentation":"copy_legacy_tree recursively copies a legacy capsule directory tree, and each entry must have a file name to compute its destination path. When an entry has no file name (e.g. a path ending in '..' or an unusual filesystem entry), the library throws because it cannot determine where to copy the entry.","triggerScenarios":"copy_legacy_tree (or canonical_legacy_archive through it) iterates read_dir_sorted(source) and encounters a directory entry whose file_name() is None — the path component ends with .. or is otherwise nameless.","commonSituations":"Legacy capsule directories containing malformed entries; paths produced by symlinks or mount points like '..' surviving into the directory listing; filesystem oddities when migrating old capsule layouts.","solutions":["Inspect the legacy capsule directory for odd entries (dotdot paths, mount points, nameless entries) and remove or rename them.","Rebuild the legacy capsule tree with a clean directory layout and rerun the copy/ canonicalization.","Copy the tree manually into the expected layout if the source filesystem produces pathological entries."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match copy_legacy_tree(&src, &dst) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"no name\") => {\n        eprintln!(\"legacy tree has a nameless entry: {e:#}\");\n        // inspect and clean the source directory, then retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Audit legacy capsule directories for '..' entries, dangling mounts, or symlinks before migration","Keep legacy capsule layouts plain (regular files/dirs with normal names)","Run the migration on the same filesystem type the tree was created on"],"tags":["filesystem","legacy-migration"],"backgroundTag":"invalid-argument-value","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"}