{"record":{"id":"befeffb90b51e359","repo":"denoland/deno","slug":"unknown-media-type-value-value","errorCode":null,"errorMessage":"Unknown media type value: {value}","messagePattern":"Unknown media type value: (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"critical","filePath":"cli/lib/standalone/binary.rs","lineNumber":307,"sourceCode":"      4 => MediaType::TypeScript,\n      5 => MediaType::Mts,\n      6 => MediaType::Cts,\n      7 => MediaType::Dts,\n      8 => MediaType::Dmts,\n      9 => MediaType::Dcts,\n      10 => MediaType::Tsx,\n      11 => MediaType::Json,\n      12 => MediaType::Jsonc,\n      13 => MediaType::Json5,\n      14 => MediaType::Markdown,\n      15 => MediaType::Wasm,\n      16 => MediaType::Css,\n      17 => MediaType::Html,\n      18 => MediaType::SourceMap,\n      19 => MediaType::Sql,\n      20 => MediaType::Unknown,\n      value => {\n        return Err(std::io::Error::new(\n          std::io::ErrorKind::InvalidData,\n          format!(\"Unknown media type value: {value}\"),\n        ));\n      }\n    };\n    Ok((input, value))\n  }\n}\n\n/// Data stored keyed by specifier.\npub struct SpecifierDataStore<TData> {\n  data: IndexMap<SpecifierId, TData>,\n}\n\nimpl<TData> Default for SpecifierDataStore<TData> {\n  fn default() -> Self {\n    Self {\n      data: IndexMap::new(),","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lib/standalone/binary.rs#L289-L325","documentation":"Compiled Deno binaries embed a metadata section where each specifier's media type is stored as a small integer tag (currently 0–20: Unknown through the newest types). While deserializing, any value outside the known range yields io::ErrorKind::InvalidData 'Unknown media type value: N'. In practice this means the binary's metadata was written by a newer Deno than the runtime reading it (new media types get new tags), or the bytes are corrupted.","triggerScenarios":"Running a compiled binary whose embedded data is read by an older deno/denort (forward incompatibility: tag 19 Sql or later added values vs an older reader); offsets into the metadata section shifted by corruption so a non-tag byte is decoded as the tag.","commonSituations":"Compiling with a new Deno version but executing through an older cached denort or an older wrapper that re-reads the section; artifacts built on a dev machine with Deno canary, deployed to machines with stable Deno; bit-rot in transferred artifacts (usually accompanied by other parse errors).","solutions":["Recompile the binary with the same Deno version that will run it (check `deno --version` on both ends)","Upgrade the runtime side to at least the version that produced the binary","If versions already match, treat the artifact as corrupted: rebuild and verify checksums"],"exampleFix":"# before\n# built with deno canary 2.x, run on older denort\ndeno compile -o app src/mod.ts  # on machine A (new)\n./app                          # on machine B (old) -> Unknown media type value: 19\n\n# after\n# machine B: upgrade, then rebuild there\ndeno upgrade && deno compile -o app src/mod.ts && ./app","handlingStrategy":"validation","validationCode":"// Stamp the builder version into the artifact and check before running\nconst BUILT_WITH = \"2.4.7\"; // set by your build script\nif (BUILT_WITH !== Deno.version.deno) {\n  throw new Error(`Binary built with deno ${BUILT_WITH} but running under ${Deno.version.deno}; upgrade or rebuild`);\n}","typeGuard":null,"tryCatchPattern":"// Wrapper that executes a compiled binary\nconst { code, stderr } = await Deno.command(binary).output();\nif (code !== 0 && new TextDecoder().decode(stderr).includes(\"Unknown media type value\")) {\n  // forward-incompatible binary: upgrade denort/deno, then re-run\n}","preventionTips":["Use the same (or newer) Deno version to run binaries than the version that compiled them","Record deno --version in CI next to every compiled artifact","Treat media-tag parse errors as version/corruption signals, never retry blindly"],"tags":["standalone-binary","compile","media-type","deserialization","version-mismatch"],"backgroundTag":"binary-version-mismatch","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}