{"record":{"id":"96721f1f56553c9c","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-the-prompttemplate-s-promptvalues-96721f","errorCode":null,"errorMessage":"Invalid JSON in the PromptTemplate's promptValues: ${exception}","messagePattern":"Invalid JSON in the PromptTemplate's promptValues: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts","lineNumber":53,"sourceCode":"                name: 'promptValues',\n                type: 'json',\n                optional: true,\n                acceptVariable: true,\n                list: true\n            }\n        ]\n    }\n\n    async init(nodeData: INodeData): Promise<any> {\n        let template = nodeData.inputs?.template as string\n        const promptValuesStr = nodeData.inputs?.promptValues\n\n        let promptValues: ICommonObject = {}\n        if (promptValuesStr) {\n            try {\n                promptValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)\n            } catch (exception) {\n                throw new Error(\"Invalid JSON in the PromptTemplate's promptValues: \" + exception)\n            }\n        }\n\n        const inputVariables = getInputVariables(template)\n        template = transformBracesWithColon(template)\n\n        try {\n            const options: PromptTemplateInput = {\n                template,\n                inputVariables\n            }\n            const prompt = new PromptTemplate(options)\n            prompt.promptValues = promptValues\n            return prompt\n        } catch (e) {\n            throw new Error(e)\n        }\n    }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts#L35-L71","documentation":"PromptTemplate.init parses `nodeData.inputs?.promptValues` as JSON when it is a string. Malformed JSON triggers JSON.parse throwing inside the try, rethrown with this message.","triggerScenarios":"promptValues field holds invalid JSON; non-JSON templated values pasted by the user.","commonSituations":"Manual editing of the promptValues field; passing a templated expression result that wasn't JSON-encoded.","solutions":["Use valid JSON: `{\"key\": \"value\"}`.","Pass an object from a prior node.","Run the JSON through a linter.","Improve the error message to expose parse offset and input snippet."],"exampleFix":"// before\npromptValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)\n// after\nif (typeof promptValuesStr === 'string') {\n  try { promptValues = JSON.parse(promptValuesStr) }\n  catch (e) { throw new Error(`PromptTemplate promptValues invalid JSON: ${(e as Error).message}. Got: ${promptValuesStr.slice(0,120)}`) }\n} else promptValues = promptValuesStr","handlingStrategy":"validation","validationCode":"function parsePromptValues(input: unknown): ICommonObject {\n  if (input == null) return {}\n  if (typeof input === 'object') return input as ICommonObject\n  try { return JSON.parse(input) }\n  catch (e) { throw new Error(`PromptTemplate promptValues invalid JSON: ${(e as Error).message}`) }\n}","typeGuard":"const isPlainObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v)","tryCatchPattern":null,"preventionTips":["Use valid JSON with double quotes.","Pass objects between nodes.","Validate before submission."],"tags":["json","validation","prompt","prompt-template"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}