{"record":{"id":"947d58719141d4d5","repo":"n8n-io/n8n","slug":"failed-to-load-headers-file","errorCode":null,"errorMessage":"Failed to load headers file","messagePattern":"Failed to load headers file","errorType":"exception","errorClass":"InternalServerError","httpStatus":500,"severity":"error","filePath":"packages/cli/src/controllers/translation.controller.ts","lineNumber":60,"sourceCode":"\t\t\treturn require(translationPath);\n\t\t} catch (error) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t@Get('/node-translation-headers')\n\tasync getNodeTranslationHeaders() {\n\t\ttry {\n\t\t\tawait access(`${NODE_HEADERS_PATH}.js`);\n\t\t} catch {\n\t\t\treturn; // no headers available\n\t\t}\n\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn require(NODE_HEADERS_PATH);\n\t\t} catch (error) {\n\t\t\tthrow new InternalServerError('Failed to load headers file', error);\n\t\t}\n\t}\n}\n","sourceCodeStart":42,"sourceCodeEnd":64,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/controllers/translation.controller.ts#L42-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No pure pre-check; ensure a clean build produced the headers file. Caller can fall back to no headers on 500.\nfunction shouldAttemptHeaders() { return true; } // guarded by try/catch below","typeGuard":null,"tryCatchPattern":"try {\n  await api.get('/node-translation-headers');\n} catch (e) {\n  if (e.status === 500 && /Failed to load headers file/.test(e.message)) {\n    // rebuild to regenerate the headers bundle; fall back to no custom headers meanwhile\n  } else { throw e; }\n}","preventionTips":["Regenerate the headers bundle on dependency/version changes.","Treat a malformed headers file as a build defect, not a runtime retry."],"tags":["i18n","build","assets","nodes"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}