n8n-io/n8n · error · NodeOperationError
The provided workflow is not valid JSON
Error message
The provided workflow is not valid JSON: "${(error as Error).message}" What it means
Retriever Workflow node in 'parameter' source mode tried to JSON.parse the workflowJson parameter into an IWorkflowBase and the parse threw — the pasted workflow JSON is syntactically invalid (truncation, stray characters). The parse error message is chained.
Solutions
- Fix the JSON syntax in the workflowJson parameter (validate it in an editor)
- Load the workflow by URL or id instead of pasting JSON
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/@n8n/nodes-langchain/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.ts:345 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4d66337f71379a27.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/nodes-langchain/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.ts:345
const { value } = this.executeFunctions.getNodeParameter(
'workflowId',
itemIndex,
{},
) as INodeParameterResourceLocator;
workflowInfo.id = value as string;
}
baseMetadata.workflowId = workflowInfo.id;
} else if (source === 'parameter') {
// Read workflow from parameter
const workflowJson = this.executeFunctions.getNodeParameter(
'workflowJson',
itemIndex,
) as string;
try {
workflowInfo.code = JSON.parse(workflowJson) as IWorkflowBase;
} catch (error) {
throw new NodeOperationError(
this.executeFunctions.getNode(),
`The provided workflow is not valid JSON: "${(error as Error).message}"`,
{
itemIndex,
},
);
}
// same as current workflow
baseMetadata.workflowId = workflowProxy.$workflow.id;
}
const rawData: IDataObject = { query };
const workflowFieldsJson = this.executeFunctions.getNodeParameter(
'fields.values',
itemIndex,
[],View on GitHub (pinned to 5ac6606e81)