{"record":{"id":"684ec6021f0a43fb","repo":"Kong/insomnia","slug":"no-module-is-found-for-modulename","errorCode":null,"errorMessage":"no module is found for \"${moduleName}\"","messagePattern":"no module is found for \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia-testing/src/run/run.ts","lineNumber":43,"sourceCode":"        'util',\n        'url',\n        'punycode',\n        'querystring',\n        'string_decoder',\n        'stream',\n        'timers',\n        'events',\n        // follows should be npm modules\n        // but they are moved to here to avoid introducing additional dependencies\n      ].includes(moduleName)\n    ) {\n      return require(moduleName);\n    } else if (['atob', 'btoa'].includes(moduleName)) {\n      return moduleName === 'atob' ? atob : btoa;\n    } else if (externalModules.has(moduleName)) {\n      const externalModule = externalModules.get(moduleName);\n      if (!externalModule) {\n        throw Error(\\`no module is found for \"$\\{moduleName}\"\\`);\n      }\n      return externalModule;\n    }\n  \n    throw Error(\\`no module is found for \"$\\{moduleName}\"\\`);\n  };\n\n  require = requireInterceptor;\n  `;\n\n  // Ensure that the require is at the top of the file\n  return `${injectScript}\\n${source}`;\n}\n\n// declare var insomnia: Insomnia;\nconst runInternal = async <TReturn, TNetworkResponse>(\n  testSrc: string | string[],\n  options: InsomniaOptions<TNetworkResponse>,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-testing/src/run/run.ts#L25-L61","documentation":"Thrown by prependInterceptedRequireToSource in the insomnia-testing runner when a test script requires a module that is neither a whitelisted Node builtin, atob/btoa, nor in the externalModules allowlist — i.e. an unpermitted or misspelled require inside a test suite.","triggerScenarios":"Thrown at packages/insomnia-testing/src/run/run.ts:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use only the allowed builtins (assert, buffer, crypto, util, url, etc.) or atob/btoa in tests","Ensure any npm module used is registered in the externalModules allowlist or added as a dependency","Fix the module name typo if the module should exist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","contentChangedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}