{"record":{"id":"be58eb55b1ae84f2","repo":"denoland/deno","slug":"unknown-built-in-module","errorCode":null,"errorMessage":"Unknown built-in module","messagePattern":"Unknown built-in module","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/01_require.js","lineNumber":1557,"sourceCode":"      if (result.format === \"builtin\") {\n        const module = loadNativeModule(id, id);\n        if (module) {\n          return module.exports;\n        }\n        const mod = new Module(builtinFilename, parent);\n        mod.exports = {};\n        mod.loaded = true;\n        Module._cache[builtinFilename] = mod;\n        return mod.exports;\n      }\n    }\n\n    maybeEmitNativeModuleDeprecation(id);\n    const module = loadNativeModule(id, id);\n    if (!module) {\n      // TODO:\n      // throw new ERR_UNKNOWN_BUILTIN_MODULE(filename);\n      throw new Error(\"Unknown built-in module\");\n    }\n\n    return module.exports;\n  }\n\n  if (cachedModule !== undefined) {\n    updateChildren(parent, cachedModule, true);\n    if (!cachedModule.loaded) {\n      return getExportsForCircularRequire(cachedModule);\n    }\n    return cachedModule.exports;\n  }\n\n  // A resolve hook that redirected `require('zlib')` to a file path must\n  // not silently fall back to the native module via the original request.\n  if (!SetPrototypeHas(cjsHookResolvedFilenames, filename)) {\n    maybeEmitNativeModuleDeprecation(filename);\n    const mod = loadNativeModule(filename, request);","sourceCodeStart":1539,"sourceCodeEnd":1575,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/01_require.js#L1539-L1575","documentation":"Deno's require shim throws this when a node: specifier is backed by neither a polyfill nor a native module - loadNativeModule returns nothing. It is Deno's stand-in for Node's ERR_UNKNOWN_BUILTIN_MODULE (the code comment marks the precise error as a TODO), so it surfaces as a plain Error without a code property, carrying only the stack trace pointing at the requiring package.","triggerScenarios":"require('node:<builtin-deno-has-not-polyfilled>') directly, or an npm dependency reaching for a builtin Deno does not implement; a builtin that exists only in newer Node versions than the Deno runtime tracks.","commonSituations":"Instrumentation, tracing, or metrics packages probing obscure builtins; dependencies written against a newer Node API surface; optional-builtins probing code that assumes every specifier resolves.","solutions":["Upgrade Deno - builtin coverage expands every release","Use the stack trace to identify the requiring package, then pin, patch, or replace that dependency","Provide a shim: map the specifier to a local polyfill via an import map or deno.json imports"],"exampleFix":"// before\nconst inspector = require('node:internal-inspect'); // not polyfilled -> Error\n\n// after: shim via deno.json imports\n// deno.json: { 'imports': { 'node:internal-inspect': './shims/noop.ts' } }\n// shim: export default {}; export const activate = () => {};","handlingStrategy":"fallback","validationCode":"const KNOWN_UNSUPPORTED = new Set(['node:internal-inspect', 'node:trace_events']);\nfunction requireBuiltin(id: string): unknown {\n  if (KNOWN_UNSUPPORTED.has(id)) return require('./shims/noop.js');\n  return require(id);\n}","typeGuard":"function isNodeBuiltin(id: string): boolean {\n  return id === 'node:' + id.slice(5) && require('node:module').isBuiltin(id);\n}","tryCatchPattern":"try {\n  nativeMod = require('node:the-builtin');\n} catch (e) {\n  if (e instanceof Error && e.message === 'Unknown built-in module') {\n    nativeMod = require('./shims/the-builtin-shim.js'); // fallback implementation\n  } else {\n    throw e;\n  }\n}","preventionTips":["Test the full dependency tree under your Deno version in CI, not just your own imports","Upgrade Deno before adding dependencies that target the newest Node APIs","Maintain a shim map in deno.json imports for known-unsupported builtins your packages probe"],"tags":["deno","node-compat","require","builtin-module"],"backgroundTag":"unknown-builtin-module","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}