{"record":{"id":"88a8f07322a6346a","repo":"astrid-runtime/astrid","slug":"legacy-capsule-authority-entry-has-a-non-utf-8-nam","errorCode":null,"errorMessage":"legacy capsule authority entry has a non-UTF-8 name: {}","messagePattern":"legacy capsule authority entry has a non-UTF-8 name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority/status.rs","lineNumber":79,"sourceCode":"        .collect::<anyhow::Result<BTreeSet<_>>>()?;\n    let mut status = LegacyAuthorityReceiptStatus::default();\n    let mut entries = std::fs::read_dir(&directory)\n        .with_context(|| format!(\"read legacy capsule authority root {}\", directory.display()))?\n        .collect::<Result<Vec<_>, _>>()\n        .with_context(|| format!(\"read legacy capsule authority root {}\", directory.display()))?;\n    entries.sort_by_key(std::fs::DirEntry::file_name);\n    for entry in entries {\n        let path = entry.path();\n        let metadata = std::fs::symlink_metadata(&path)\n            .with_context(|| format!(\"inspect legacy capsule authority {}\", path.display()))?;\n        if metadata.file_type().is_symlink() || !metadata.is_file() {\n            bail!(\n                \"legacy capsule authority root contains a non-regular entry: {}\",\n                path.display()\n            );\n        }\n        let Some(name) = path.file_name().and_then(|name| name.to_str()) else {\n            bail!(\n                \"legacy capsule authority entry has a non-UTF-8 name: {}\",\n                path.display()\n            );\n        };\n        if name.ends_with(\".pending\") {\n            status.pending.push(path);\n        } else if name.ends_with(\".previous\") {\n            status.previous.push(path);\n        } else if !path\n            .extension()\n            .is_some_and(|extension| extension.eq_ignore_ascii_case(\"json\"))\n            || !permitted.contains(&path)\n        {\n            status.unknown_active.push(path);\n        }\n    }\n    Ok(status)\n}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority/status.rs#L61-L97","documentation":"legacy_authority_receipt_status requires receipt file names to be valid UTF-8 so they can be parsed into status categories (pending, unmatched, etc.). If path.file_name() is not representable as UTF-8, the library throws this error rather than guessing how to classify the entry.","triggerScenarios":"Calling legacy_capsule_authority_status (or its test callers) when a file in the authority root has a non-UTF-8 name (status.rs:79) — typically a file created with raw bytes in its name, e.g. by a tool using a different locale/encoding or a corrupted/carefully crafted name.","commonSituations":"Files copied from a non-UTF-8 filesystem (legacy Samba share, old FAT volume) into the authority directory; scripts creating receipts with escaped byte names; download tools preserving hostile names.","solutions":["Identify the non-UTF-8 entry with ls -b (or find . -name '*\\x*') and rename it to a UTF-8 name","If the entry is junk, delete it manually, then re-run the status command","Recreate receipts via the tool itself so names are generated with valid UTF-8","Fix the transfer path/locale that produced the raw-byte name and re-copy with convmv -t UTF-8"],"exampleFix":"// before\n$ ls ~/.astrid/authority\nreceipt\\xff.json\n// after\n$ mv $'receipt\\xff.json' receipt-fixed.json\n$ astrid authority status","handlingStrategy":"validation","validationCode":"for entry in std::fs::read_dir(root)?.filter_map(Result::ok) {\n    if entry.file_name().to_str().is_none() {\n        eprintln!(\"non-UTF-8 name: {:?}\", entry.file_name());\n    }\n}","typeGuard":"fn has_utf8_name(p: &Path) -> bool {\n    p.file_name().and_then(|n| n.to_str()).is_some()\n}","tryCatchPattern":null,"preventionTips":["Copy receipts only via UTF-8-safe transfer paths (avoid legacy Samba/FAT sources)","Fix locale/encoding settings so scripts create UTF-8 names (convmv -t UTF-8)","Rename any raw-byte file names immediately after restoring from backup"],"tags":["filesystem","encoding","utf-8"],"backgroundTag":"invalid-identifier-format","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"}