pydantic/monty · error · Error
component core module is missing: ${path}
Error message
component core module is missing: ${path} What it means
When instantiating the Jco-compiled wasm component, each core module referenced by the component's relative path must be present in the precompiled module map. getModule throws this Error when the lookup (with and without a leading './') finds nothing, meaning the build's module map is incomplete or mismatched with the generated component.
Source
Thrown at crates/monty-js/ts/worker/host.ts:76
'wasi:clocks/monotonic-clock': imports['wasi:clocks/monotonic-clock'],
'wasi:clocks/wall-clock': imports['wasi:clocks/wall-clock'],
'wasi:filesystem/preopens': imports['wasi:filesystem/preopens'],
'wasi:filesystem/types': imports['wasi:filesystem/types'],
'wasi:io/error': imports['wasi:io/error'],
'wasi:io/streams': imports['wasi:io/streams'],
'wasi:random/random': imports['wasi:random/random'],
}
}
/** Turns a guest exit into a component failure instead of terminating Node. */
function denyProcessExit(): never {
throw new Error('Monty wasm component requested process exit')
}
/** Resolves Jco's relative core-module path against the precompiled module map. */
function getModule(modules: ComponentModules, path: string): WebAssembly.Module {
const module = modules[path] ?? modules[path.replace(/^\.\//, '')]
if (!module) throw new Error(`component core module is missing: ${path}`)
return module
}
View on GitHub (pinned to adc986b362)
Solutions
- Rebuild the wasm component with `make build-wasm` so the module map and component are regenerated together
- Check the quoted path in the message against the keys of your modules map and fix the mapping/bundling
- Ensure the installed @pydantic/monty package versions are consistent (no mixed versions of the wasm entry point)
- If bundling yourself, keep Jco's relative core-module paths intact
Example fix
// before
const modules = { 'monty.core.wasm': core } // missing './' variant expected by component
// after
const modules = { './monty.core.wasm': core, 'monty.core.wasm': core } Defensive patterns
Strategy: try-catch
Validate before calling
for (const p of expectedCoreModulePaths) { if (!modules[p] && !modules[p.replace(/^\.\//, '')]) throw new Error(`missing core module: ${p}`) } Type guard
null
Try / catch
try { const comp = component(modules, imports) } catch (e) { if (e.message.startsWith('component core module is missing')) throw new Error('stale wasm build — rerun make build-wasm') ; throw e } Prevention
- Run `make build-wasm` after updating monty or the TS wasm layer so the module map regenerates with the component
- Never hand-edit or rename Jco-generated core-module paths in your bundler
- Pin all @pydantic/monty packages to the same version
- Log the modules map keys when instantiation fails to spot mismatches quickly
When it happens
Trigger: Using the wasm worker path where the ComponentModules map passed to the host was built from a different component version than the checked-in/generated component imports; a path like './monty.core.wasm' missing from the map.
Common situations: Stale build artifacts after `make build-wasm` was skipped or partially run; version skew between the published @pydantic/monty/wasm TS layer and bundled component; custom bundling that renamed or dropped core modules.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Monty.create could not auto-load the monty wasm module in th
- Monty wasm component requested process exit
- the wasm worker does not support filesystem mounts (browser
- Dump returned an unexpected event
- ${what} produced no turn-ending event (worker crashed)
AI-assisted analysis of pydantic/monty@adc986b362 (2026-09-13).
Data as JSON: /api/errors/4dd35befb986068a.
Report an issue: GitHub.