denoland/deno · critical · std::io::Error
Unknown media type value: {value}
Error message
Unknown media type value: {value} What it means
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.
Source
Thrown at cli/lib/standalone/binary.rs:307
4 => MediaType::TypeScript,
5 => MediaType::Mts,
6 => MediaType::Cts,
7 => MediaType::Dts,
8 => MediaType::Dmts,
9 => MediaType::Dcts,
10 => MediaType::Tsx,
11 => MediaType::Json,
12 => MediaType::Jsonc,
13 => MediaType::Json5,
14 => MediaType::Markdown,
15 => MediaType::Wasm,
16 => MediaType::Css,
17 => MediaType::Html,
18 => MediaType::SourceMap,
19 => MediaType::Sql,
20 => MediaType::Unknown,
value => {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!("Unknown media type value: {value}"),
));
}
};
Ok((input, value))
}
}
/// Data stored keyed by specifier.
pub struct SpecifierDataStore<TData> {
data: IndexMap<SpecifierId, TData>,
}
impl<TData> Default for SpecifierDataStore<TData> {
fn default() -> Self {
Self {
data: IndexMap::new(),View on GitHub (pinned to 9ad36f7a2c)
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
Example fix
# before # built with deno canary 2.x, run on older denort deno compile -o app src/mod.ts # on machine A (new) ./app # on machine B (old) -> Unknown media type value: 19 # after # machine B: upgrade, then rebuild there deno upgrade && deno compile -o app src/mod.ts && ./app
Defensive patterns
Strategy: validation
Validate before calling
// Stamp the builder version into the artifact and check before running
const BUILT_WITH = "2.4.7"; // set by your build script
if (BUILT_WITH !== Deno.version.deno) {
throw new Error(`Binary built with deno ${BUILT_WITH} but running under ${Deno.version.deno}; upgrade or rebuild`);
} Try / catch
// Wrapper that executes a compiled binary
const { code, stderr } = await Deno.command(binary).output();
if (code !== 0 && new TextDecoder().decode(stderr).includes("Unknown media type value")) {
// forward-incompatible binary: upgrade denort/deno, then re-run
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Unexpected end of data
- unsupported media type {} for {}
- Unexpected end of data
- Unexpected second argument to Deno.bench()
- Unexpected 'fn' field in options, bench function is already
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/befeffb90b51e359.
Report an issue: GitHub.