{"record":{"id":"6a9cad8700fd1ffc","repo":"biomejs/biome","slug":"does-not-contain-unicode-version-expected-version","errorCode":null,"errorMessage":"{} does not contain Unicode version {expected_version}","messagePattern":"(.+?) does not contain Unicode version (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/unicode.rs","lineNumber":214,"sourceCode":"    /// Return an error if reading cache or fetching fresh data from the unicode website fails.\n    pub fn cached_or_fetch(\n        cache_path: &'static str,\n        source_url: &str,\n        expected_version: &str,\n        expected_size: usize,\n    ) -> Result<Self> {\n        Self::from_cache(cache_path)\n            .and_then(|properties| properties.validate(expected_version, expected_size))\n            .or_else(|_| {\n                let fetched = Self::fetch(cache_path, source_url)?\n                    .validate(expected_version, expected_size)?;\n                fetched.save_cache()?;\n                Ok(fetched)\n            })\n    }\n\n    fn validate(self, expected_version: &str, expected_size: usize) -> Result<Self> {\n        anyhow::ensure!(\n            self.raw\n                .lines()\n                .take(10)\n                .any(|line| line.contains(expected_version)),\n            \"{} does not contain Unicode version {expected_version}\",\n            self.path().display()\n        );\n        anyhow::ensure!(\n            self.raw.len() == expected_size,\n            \"{} has size {}, expected {expected_size}\",\n            self.path().display(),\n            self.raw.len()\n        );\n\n        Ok(self)\n    }\n\n    fn path(&self) -> PathBuf {","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/unicode.rs#L196-L232","documentation":"Validation error in xtask/codegen's Unicode data downloader. After fetching a Unicode data file (e.g. ScriptExtensions.txt), the `validate` method checks that the first 10 lines of the raw content mention the expected Unicode version; if not, it fails with the file path in the message. This guards against cached/stale/mismatched files whose version does not match what the generator was built for.","triggerScenarios":"Running the Unicode codegen task (`xtask unicode` / related just commands) when the downloaded or cached file's header lines do not contain the expected version string passed by the caller.","commonSituations":"A stale cache from a previous Unicode version on disk; the upstream Unicode consortium replacing/renaming a file so headers changed; a mismatch between the version constant in the xtask source and the fetched URL; a proxy or mirror returning an HTML error page instead of the data file.","solutions":["Clear the download cache (delete the cached file shown in the error, typically under the xtask cache/temp directory) and re-run to fetch fresh data.","Verify the Unicode version constant in xtask matches the version of the data file being fetched; update the expected version or the URL together.","Inspect the first lines of the file at the reported path to see what was actually downloaded; if it is an error page, fix network/proxy access.","If the upstream file format changed its header, adjust the version constant or validation window in unicode.rs."],"exampleFix":"# before: stale cached file from Unicode 15.0 while codegen expects 15.1\nrm -rf ~/.cache/biome/unicode/\njust gen-unicode  # re-downloads and validates the expected version\n# after: validation passes with the freshly fetched 15.1 file","handlingStrategy":"validation","validationCode":"// Verify a Unicode data file matches the expected version before feeding it to codegen\nfn matches_version(path: &std::path::Path, expected: &str) -> anyhow::Result<()> {\n    let head: String = std::fs::read_to_string(path)?\n        .lines()\n        .take(10)\n        .collect::<Vec<_>>()\n        .join(\"\\n\");\n    anyhow::ensure!(head.contains(expected), \"{} is not version {expected}\", path.display());\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"// Wrap the codegen invocation and handle version mismatch explicitly\nmatch xtask::unicode::generate() {\n    Err(e) if e.to_string().contains(\"does not contain Unicode version\") => {\n        eprintln!(\"stale/mismatched Unicode data: {e}; clear the cache and retry\");\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {}\n}","preventionTips":["Delete the Unicode download cache whenever bumping the expected Unicode version in xtask.","Bump the version constant and the data-file URLs in the same change.","Check that your network/proxy returns the real file, not an HTML error page, before codegen.","Keep the validation header window (first 10 lines) in sync with upstream header format changes."],"tags":["codegen","unicode","version-mismatch","cache"],"backgroundTag":"checksum-mismatch","analyzedSha":"3835945f0638c88162351318b7bc8b64c5f2fba7","analyzedAt":"2026-09-13T15:11:16.919Z","contentChangedAt":"2026-09-13T15:11:16.919Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}