{"record":{"id":"9a4ac0a4f7604bc7","repo":"n8n-io/n8n","slug":"failed-to-parse-node-types-from-jsonpath-err","errorCode":null,"errorMessage":"Failed to parse node types from ${jsonPath}: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Failed to parse node types from (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/generate-types/generate-types.ts","lineNumber":4247,"sourceCode":"// =============================================================================\n// Node Loading\n// =============================================================================\n\n/**\n * Load node types from JSON file\n * @param jsonPath Path to the nodes.json file\n * @param packageName Package name to prefix node names with (e.g., 'n8n-nodes-base')\n */\nexport async function loadNodeTypes(\n\tjsonPath: string,\n\tpackageName?: string,\n): Promise<NodeTypeDescription[]> {\n\tconst content = await fs.promises.readFile(jsonPath, 'utf-8');\n\tlet nodes: NodeTypeDescription[];\n\ttry {\n\t\tnodes = JSON.parse(content) as NodeTypeDescription[];\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to parse node types from ${jsonPath}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\n\t// If package name provided and node names don't have package prefix, add it\n\tif (packageName) {\n\t\tfor (const node of nodes) {\n\t\t\tif (!node.name.includes('.')) {\n\t\t\t\tnode.name = `${packageName}.${node.name}`;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodes;\n}\n\n/**\n * Convert a node to its tool variant.","sourceCodeStart":4229,"sourceCodeEnd":4265,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/generate-types/generate-types.ts#L4229-L4265","documentation":"loadNodeTypes() reads the nodes.json file and JSON.parse()s it; if the content is not valid JSON it rethrows, embedding the underlying parse error message and the path. This is the loader used by the generate-types pipeline.","triggerScenarios":"nodes.json is truncated, contains trailing commas or // comments, is an empty file, holds an HTML error page instead of JSON, or has a stray BOM/encoding issue.","commonSituations":"Hand-edited nodes.json with JSON5 syntax; a partial/failed write left a truncated file; a 404 page was saved as nodes.json; encoding conversion introduced invalid bytes.","solutions":["Validate the file with a JSON linter (e.g. node -e \"JSON.parse(require('fs').readFileSync('nodes.json','utf8'))\") to see the exact syntax error.","Regenerate nodes.json by rerunning the package build.","Confirm the file is non-empty and contains an array of NodeTypeDescription objects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-validate JSON before relying on loadNodeTypes.\nimport * as fs from 'fs';\nconst raw = fs.readFileSync(jsonPath, 'utf-8');\ntry { JSON.parse(raw); } catch (e) {\n  throw new Error(`nodes.json at ${jsonPath} is not valid JSON: ${(e as Error).message}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const types = await loadNodeTypes(jsonPath, packageName);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to parse node types')) {\n    // regenerate nodes.json from the build, then retry\n    throw e;\n  }\n  throw e;\n}","preventionTips":["Treat nodes.json as build output — regenerate it rather than hand-editing.","Keep JSON strict (no comments, no trailing commas).","Verify the file is non-empty and starts with '[' before parsing."],"tags":["build","cli","json","config"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}