{"record":{"id":"4d66337f71379a27","repo":"n8n-io/n8n","slug":"the-provided-workflow-is-not-valid-json-error","errorCode":null,"errorMessage":"The provided workflow is not valid JSON: \"${(error as Error).message}\"","messagePattern":"The provided workflow is not valid JSON: \"(.+?)\"","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.ts","lineNumber":345,"sourceCode":"\t\t\t\t\t\tconst { value } = this.executeFunctions.getNodeParameter(\n\t\t\t\t\t\t\t'workflowId',\n\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t) as INodeParameterResourceLocator;\n\t\t\t\t\t\tworkflowInfo.id = value as string;\n\t\t\t\t\t}\n\n\t\t\t\t\tbaseMetadata.workflowId = workflowInfo.id;\n\t\t\t\t} else if (source === 'parameter') {\n\t\t\t\t\t// Read workflow from parameter\n\t\t\t\t\tconst workflowJson = this.executeFunctions.getNodeParameter(\n\t\t\t\t\t\t'workflowJson',\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t) as string;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tworkflowInfo.code = JSON.parse(workflowJson) as IWorkflowBase;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\tthis.executeFunctions.getNode(),\n\t\t\t\t\t\t\t`The provided workflow is not valid JSON: \"${(error as Error).message}\"`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// same as current workflow\n\t\t\t\t\tbaseMetadata.workflowId = workflowProxy.$workflow.id;\n\t\t\t\t}\n\n\t\t\t\tconst rawData: IDataObject = { query };\n\n\t\t\t\tconst workflowFieldsJson = this.executeFunctions.getNodeParameter(\n\t\t\t\t\t'fields.values',\n\t\t\t\t\titemIndex,\n\t\t\t\t\t[],","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.ts#L327-L363","documentation":"Error \"The provided workflow is not valid JSON: \"${(error as Error).message}\"\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/nodes-langchain/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.ts:345 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}