{"record":{"id":"a08e1decc29da66a","repo":"astrid-runtime/astrid","slug":"leftover-capsule-authority-receipt-has-no-file-nam","errorCode":null,"errorMessage":"leftover capsule authority receipt has no file name: {}","messagePattern":"leftover capsule authority receipt has no file name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority/leftover.rs","lineNumber":108,"sourceCode":"    Ok(Some((receipt, bytes)))\n}\n\n/// Move one leftover receipt out of the live authority directory.\npub(crate) fn quarantine_legacy_authority_receipt(\n    home: &AstridHome,\n    path: &Path,\n) -> anyhow::Result<PathBuf> {\n    let bytes = fs::read(path)\n        .with_context(|| format!(\"read leftover capsule authority {}\", path.display()))?;\n    let quarantine_root = home.migrations_dir().join(QUARANTINE_DIR);\n    astrid_core::platform_fs::ensure_private_directory(&quarantine_root).with_context(|| {\n        format!(\n            \"secure leftover authority quarantine {}\",\n            quarantine_root.display()\n        )\n    })?;\n    let file_name = path.file_name().ok_or_else(|| {\n        anyhow::anyhow!(\n            \"leftover capsule authority receipt has no file name: {}\",\n            path.display()\n        )\n    })?;\n    let destination = unique_quarantine_path(&quarantine_root, file_name)?;\n    fs::rename(path, &destination).with_context(|| {\n        format!(\n            \"quarantine leftover capsule authority {} to {}\",\n            path.display(),\n            destination.display()\n        )\n    })?;\n    if let Some(parent) = path.parent() {\n        sync_authority_directory(parent)?;\n    }\n    let preserved = fs::read(&destination).with_context(|| {\n        format!(\n            \"read quarantined capsule authority {}\",","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority/leftover.rs#L90-L126","documentation":"When retiring a legacy capsule authority receipt, quarantine_legacy_authority_receipt moves the receipt file into a quarantine directory via fs::rename and needs the file's name to build the destination. A path without a final component (e.g. a root path or path ending in ..) makes this impossible, so it errors instead of silently mishandling the file.","triggerScenarios":"quarantine_legacy_authority_receipt is called (directly or via retire_one_leftover) with a receipt path that has no file_name — typically a path like \"/\" or a normalized path whose last component is missing.","commonSituations":"Path built by string concatenation losing the filename; directory passed instead of a file; stale registry entry pointing at a path that no longer resolves to a named file.","solutions":["Ensure the leftover receipt path points to an actual file with a name","Recompute the path including its final component before calling install/cleanup","Delete the stale leftover entry so quarantine is skipped","Manually remove the receipt file if it's safe to retire"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"fn quaraninable(path: &Path) -> bool {\n    path.is_file() && path.file_name().is_some()\n}","typeGuard":"fn has_file_name(path: &Path) -> bool {\n    path.file_name().is_some()\n}","tryCatchPattern":"match quarantine_legacy_authority_receipt(...) {\n    Err(e) if e.to_string().contains(\"has no file name\") => {\n        eprintln!(\"receipt path is malformed; clean up the leftover entry manually\");\n    }\n    other => other?,\n}","preventionTips":["Always pass full file paths (not directories or roots) to install cleanup APIs","Normalize paths before storing leftover receipts","Validate leftover entries on startup and prune malformed ones"],"tags":["filesystem","authority","install","path"],"backgroundTag":"file-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}