{"record":{"id":"f9f92000df767dd8","repo":"unicity-aos/aos-ce","slug":"product-release-runtime-bin-contains-a-non-utf-8-entry","errorCode":null,"errorMessage":"product release runtime bin contains a non-UTF-8 entry","messagePattern":"product release runtime bin contains a non-UTF-8 entry","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/unicity-aos-bootstrap/src/migration.rs","lineNumber":710,"sourceCode":"    let metadata = fs::symlink_metadata(release_runtime_bin).map_err(|error| {\n        if error.kind() == io::ErrorKind::NotFound {\n            io::Error::new(\n                io::ErrorKind::InvalidInput,\n                \"bundled product release runtime executable set is not installed\",\n            )\n        } else {\n            error\n        }\n    })?;\n    if metadata.file_type().is_symlink() || !metadata.is_dir() {\n        return invalid(\"bundled product release runtime bin must be a real directory\");\n    }\n    let expected: HashSet<_> = RUNTIME_EXECUTABLE_NAMES.iter().copied().collect();\n    let mut actual = HashSet::new();\n    for entry in fs::read_dir(release_runtime_bin)? {\n        let entry = entry?;\n        let name = entry.file_name().into_string().map_err(|_| {\n            io::Error::new(\n                io::ErrorKind::InvalidInput,\n                \"product release runtime bin contains a non-UTF-8 entry\",\n            )\n        })?;\n        let metadata = fs::symlink_metadata(entry.path())?;\n        #[cfg(target_os = \"macos\")]\n        if matches!(name.as_str(), \"AstridFS.app\" | \"macos\") {\n            validate_packaged_filesystem_directory(&entry.path())?;\n            continue;\n        }\n        if !expected.contains(name.as_str())\n            || metadata.file_type().is_symlink()\n            || !metadata.is_file()\n            || !actual.insert(name)\n        {\n            return invalid(\"product release runtime contains unexpected data\");\n        }\n    }","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/crates/unicity-aos-bootstrap/src/migration.rs#L692-L728","documentation":"validate_release_runtime_bin enumerates the release runtime bin directory and converts each entry's file name to a Rust String; an entry whose name is not valid UTF-8 triggers this InvalidInput error. The validator needs String names to compare against RUNTIME_EXECUTABLE_NAMES, so non-UTF-8 entries are rejected.","triggerScenarios":"Calling migrate_runtime when the release runtime bin directory contains a file or directory whose name is not valid UTF-8 (raw bytes from an archive extraction or foreign filesystem).","commonSituations":"Extracting a release archive that contained byte-level filenames; files created by non-Unix tooling with legacy encodings; corruption during transfer.","solutions":["Remove or rename the non-UTF-8 entry in the release runtime bin directory","Re-extract the release archive on a UTF-8 locale/filesystem so names decode correctly","Validate directory contents with entry.file_name().to_str().is_some() before migrating"],"exampleFix":"// before\n$ ls bin\nfoo\u0000bar  # non-UTF-8 entry\n\n// after\n$ rm bin/foo\u0000bar   # or re-extract the release cleanly\n$ ls bin\nruntime-core","handlingStrategy":"validation","validationCode":"fn bin_names_utf8(dir: &std::path::Path) -> bool {\n    std::fs::read_dir(dir)\n        .map(|entries| entries.filter_map(|e| e.ok()).all(|e| e.file_name().to_str().is_some()))\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match migrate_runtime(&target, &release_bin) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"non-UTF-8 entry\") =>\n        eprintln!(\"remove/rename non-UTF-8 files in {}\", release_bin.display()),\n    Err(e) => return Err(e),\n}","preventionTips":["Extract release archives on a UTF-8 filesystem and locale","Reject archives containing byte-level filenames at ingestion time","Periodically scan runtime directories for undecodable names","Avoid legacy-encoding tooling when touching installed runtime files"],"tags":["rust","filesystem","encoding"],"backgroundTag":"invalid-identifier-format","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}