n8n-io/n8n · warning
CODE_NODE_NETWORK_CALL
CODE_NODE_NETWORK_CALL
Error message
${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. What it means
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.
Source
Thrown at packages/@n8n/workflow-sdk/src/lint/code-node/js.ts:165
if (required) {
if (HTTP_MODULES.has(required)) sawNetwork = true;
if (moduleIsForbidden(required)) sawForbiddenImport = true;
}
}
if (
node.type === 'NewExpression' &&
node.callee.type === 'Identifier' &&
node.callee.name === 'XMLHttpRequest'
) {
sawNetwork = true;
}
});
if (sawNetwork) {
issues.push(
lintIssue({
code: 'CODE_NODE_NETWORK_CALL',
message:
`${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.',
lintTarget: 'jsCode',
nodeName: options.nodeName,
parameterPath: 'jsCode',
}),
);
}
if (sawForbiddenImport) {
issues.push(
lintIssue({
code: 'CODE_NODE_FORBIDDEN_IMPORT',
message:
`${namePrefix}Code node imports a module unavailable in the sandbox (luxon, openai, langchain, …). ` +
'Use JavaScript `Date`/`Intl`, `$now`/`$today`, existing workflow data, or dedicated AI nodes instead.',View on GitHub (pinned to 5ac6606e81)
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.
Example fix
// before (Code node jsCode)
const r = await fetch('https://api.example.com/users');
return await r.json();
// after — use an HTTP Request node upstream, then in the Code node:
return $input.all().map((i) => i.json.users).flat(); Defensive patterns
Strategy: validation
Validate before calling
// Run lintJsCode on generated jsCode and reject CODE_NODE_NETWORK_CALL before saving.
import { lintJsCode } from '@n8n/workflow-sdk/lint/code-node/js';
const issues = lintJsCode(jsCode, { mode });
if (issues.some((i) => i.code === 'CODE_NODE_NETWORK_CALL')) {
throw new Error('jsCode contains a network call; move it to an HTTP Request node.');
} Prevention
- 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.
When it happens
Trigger: 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').
Common situations: 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.
Related errors
- CODE_NODE_NETWORK_CALL
- CODE_NODE_FORBIDDEN_IMPORT
- CODE_MODE_API_MISUSE
- CODE_NESTED_TEMPLATE_LITERAL
- SDK_AS_CONST
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/7a9f719668721960.
Report an issue: GitHub.