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

  1. Rebuild the wasm component with `make build-wasm` so the module map and component are regenerated together
  2. Check the quoted path in the message against the keys of your modules map and fix the mapping/bundling
  3. Ensure the installed @pydantic/monty package versions are consistent (no mixed versions of the wasm entry point)
  4. 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

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


AI-assisted analysis of pydantic/monty@adc986b362 (2026-09-13). Data as JSON: /api/errors/4dd35befb986068a. Report an issue: GitHub.