n8n-io/n8n · error · InternalServerError
Failed to load headers file
Error message
Failed to load headers file
What it means
The node-translation-headers endpoint first checks the headers file exists (access .js); if present but require() throws, the controller wraps the failure as 500 InternalServerError 'Failed to load headers file' with the original error attached.
Source
Thrown at packages/cli/src/controllers/translation.controller.ts:60
return require(translationPath);
} catch (error) {
return null;
}
}
@Get('/node-translation-headers')
async getNodeTranslationHeaders() {
try {
await access(`${NODE_HEADERS_PATH}.js`);
} catch {
return; // no headers available
}
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return require(NODE_HEADERS_PATH);
} catch (error) {
throw new InternalServerError('Failed to load headers file', error);
}
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Regenerate the node-translation headers bundle (rebuild) so the file is valid.
- Delete the stale headers file and rebuild so it is produced cleanly.
- Inspect the attached original error in server logs to find the require() failure (syntax error, missing export).
Defensive patterns
Strategy: try-catch
Validate before calling
// No pure pre-check; ensure a clean build produced the headers file. Caller can fall back to no headers on 500.
function shouldAttemptHeaders() { return true; } // guarded by try/catch below Try / catch
try {
await api.get('/node-translation-headers');
} catch (e) {
if (e.status === 500 && /Failed to load headers file/.test(e.message)) {
// rebuild to regenerate the headers bundle; fall back to no custom headers meanwhile
} else { throw e; }
} Prevention
- Regenerate the headers bundle on dependency/version changes.
- Treat a malformed headers file as a build defect, not a runtime retry.
When it happens
Trigger: GET /node-translation-headers where NODE_HEADERS_PATH.js exists (access succeeds) but require(NODE_HEADERS_PATH) throws — corrupt, truncated, or syntactically invalid generated headers bundle.
Common situations: A partial/interrupted build left a malformed headers file; the headers generation step wrote an empty or syntactically broken module; version skew between the headers bundle and the runtime.
Related errors
- Third-party licenses file not found
- Invalid Credential type: "${credentialType}"
- Agent "${this.name}" requires a model
- Agent "${this.name}" requires instructions
- NODE_NOT_FOUND
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/947d58719141d4d5.
Report an issue: GitHub.