denoland/deno · error
Import map not found in eszip: {}
Error message
Import map not found in eszip: {} What it means
A standalone binary produced by deno compile carries its modules in an eszip archive. When it needs the import map at runtime, it looks the import map's specifier up in that archive; a missing entry bails with "Import map not found in eszip" plus the specifier it wanted.
Source
Thrown at cli/module_loader.rs:2278
for specifier in specifiers {
let module = loaded_eszip.get_module(&specifier).unwrap();
let source = module.take_source().await.unwrap();
let resolved_specifier = resolve_url_or_path(&specifier, cwd)?;
let prev = loader.files.insert(resolved_specifier, source);
assert!(prev.is_none());
}
}
Ok(loader)
}
pub fn load_import_map_value(
&self,
specifier: &ModuleSpecifier,
) -> Result<serde_json::Value, AnyError> {
match self.files.get(specifier) {
Some(bytes) => Ok(serde_json::from_slice(bytes.as_ref())?),
None => bail!("Import map not found in eszip: {}", specifier),
}
}
fn load(&self, specifier: &ModuleSpecifier) -> deno_core::ModuleLoadResponse {
match self.files.get(specifier) {
Some(source) => {
let module_source = ModuleSource::new(
ModuleType::JavaScript,
ModuleSourceCode::Bytes(deno_core::ModuleCodeBytes::Arc(
source.clone(),
)),
specifier,
None,
);
deno_core::ModuleLoadResponse::Sync(Ok(module_source))
}
None => deno_core::ModuleLoadResponse::Sync(Err(JsErrorBox::generic(
"Module not found",View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Recompile the binary with a current Deno from the same project state so the import map is embedded in the eszip
- Keep imports in the deno.json used at compile time so they are captured deterministically
- If the import map must stay external, ship it next to the binary and load it at runtime instead of expecting it inside the eszip
Example fix
# before # binary compiled earlier, then import map changed: ./app # Import map not found in eszip: file://.../import.map.json # after # recompile from the current project so the map is embedded deno compile --output app main.ts
Defensive patterns
Strategy: fallback
Validate before calling
// Smoke-test the compiled binary as part of the build
const cmd = new Deno.Command("./app", { args: ["--version"], stderr: "piped" });
const { stderr } = await cmd.output();
if (new TextDecoder().decode(stderr).includes("Import map not found in eszip")) {
throw new Error("import map missing from eszip - recompile from current config");
} Try / catch
try {
await runCompiledBinary(args);
} catch (e) {
if (String(e).includes("Import map not found in eszip")) {
// fallback: recompile the binary from the current project state, then retry
await recompile();
await runCompiledBinary(args);
} else {
throw e;
}
} Prevention
- Recompile standalone binaries whenever the import map or deno.json changes
- Treat the binary and its config as one artifact: rebuild both in the same CI step
- Smoke-test each compiled binary (one real run) before shipping it
When it happens
Trigger: Running a compiled binary whose eszip lacks the import map entry - typically a binary compiled before the import map was recorded, compiled from a different config/import-map state, or whose recorded import-map specifier no longer matches.
Common situations: Old CI artifacts executed after the project's import map moved or was renamed; recompiling with a different config than the one used originally; Deno version changes in how the import-map specifier is recorded.
Related errors
- Redirects should be resolved
- redirects are already resolved
- path not found (not dir): {}
- path not found (entry missing): {}
- Unhandled scenario where a duplicate entry was found: {:?}
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/bf8bf0038f589a3d.
Report an issue: GitHub.