{"record":{"id":"7a9f719668721960","repo":"n8n-io/n8n","slug":"code-node-network-call","errorCode":"CODE_NODE_NETWORK_CALL","errorMessage":"${namePrefix}Code node calls fetch/axios/XMLHttpRequest or requires an HTTP module. Code nodes have no network access at runtime — make the HTTP/API call with an HTTP Request node and transform its output in the Code node instead.","messagePattern":"(.+?)Code node calls fetch/axios/XMLHttpRequest or requires an HTTP module\\. Code nodes have no network access at runtime — make the HTTP/API call with an HTTP Request node and transform its output in the Code node instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/@n8n/workflow-sdk/src/lint/code-node/js.ts","lineNumber":165,"sourceCode":"\t\t\tif (required) {\n\t\t\t\tif (HTTP_MODULES.has(required)) sawNetwork = true;\n\t\t\t\tif (moduleIsForbidden(required)) sawForbiddenImport = true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tnode.type === 'NewExpression' &&\n\t\t\tnode.callee.type === 'Identifier' &&\n\t\t\tnode.callee.name === 'XMLHttpRequest'\n\t\t) {\n\t\t\tsawNetwork = true;\n\t\t}\n\t});\n\n\tif (sawNetwork) {\n\t\tissues.push(\n\t\t\tlintIssue({\n\t\t\t\tcode: 'CODE_NODE_NETWORK_CALL',\n\t\t\t\tmessage:\n\t\t\t\t\t`${namePrefix}Code node calls fetch/axios/XMLHttpRequest or requires an HTTP module. ` +\n\t\t\t\t\t'Code nodes have no network access at runtime — make the HTTP/API call with an HTTP Request node ' +\n\t\t\t\t\t'and transform its output in the Code node instead.',\n\t\t\t\tlintTarget: 'jsCode',\n\t\t\t\tnodeName: options.nodeName,\n\t\t\t\tparameterPath: 'jsCode',\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (sawForbiddenImport) {\n\t\tissues.push(\n\t\t\tlintIssue({\n\t\t\t\tcode: 'CODE_NODE_FORBIDDEN_IMPORT',\n\t\t\t\tmessage:\n\t\t\t\t\t`${namePrefix}Code node imports a module unavailable in the sandbox (luxon, openai, langchain, …). ` +\n\t\t\t\t\t'Use JavaScript `Date`/`Intl`, `$now`/`$today`, existing workflow data, or dedicated AI nodes instead.',","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/lint/code-node/js.ts#L147-L183","documentation":"CODE_NODE_NETWORK_CALL (js) is a lint issue, not a thrown error. lintJsCode() parses the jsCode with acorn and flags any network access: direct fetch/axios/XMLHttpRequest calls, new XMLHttpRequest(), or import/require of http, https, http2, node-fetch, axios, got, undici (and node: variants). Code nodes have no network access at runtime, so the fix is to move the call to an HTTP Request node.","triggerScenarios":"fetch('https://api.x'), await axios.get(url), const x = new XMLHttpRequest(), require('https'), import 'node-fetch', await import('node:https'), or const http = require('http').","commonSituations":"LLM emits an API call inside a Code node; a developer ports a script that does HTTP directly; agent confuses Code node with a general JS runtime.","solutions":["Replace the network call with an HTTP Request node, then transform that node's output in the Code node.","Remove the fetch/axios/XMLHttpRequest call or the http/https/axios/got/undici import entirely.","If you only need outbound HTTP, wire an HTTP Request node upstream and consume $input in the Code node."],"exampleFix":"// before (Code node jsCode)\nconst r = await fetch('https://api.example.com/users');\nreturn await r.json();\n// after — use an HTTP Request node upstream, then in the Code node:\nreturn $input.all().map((i) => i.json.users).flat();","handlingStrategy":"validation","validationCode":"// Run lintJsCode on generated jsCode and reject CODE_NODE_NETWORK_CALL before saving.\nimport { lintJsCode } from '@n8n/workflow-sdk/lint/code-node/js';\nconst issues = lintJsCode(jsCode, { mode });\nif (issues.some((i) => i.code === 'CODE_NODE_NETWORK_CALL')) {\n  throw new Error('jsCode contains a network call; move it to an HTTP Request node.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never put fetch/axios/XMLHttpRequest or http/https imports in Code node jsCode.","Wire an HTTP Request node upstream and transform its output in the Code node.","Gate generated workflows on lintJsCode in CI to catch network calls early."],"tags":["lint","code-node","network","sdk"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}