{"record":{"id":"37fda34b75ba63d6","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-the-prompttemplate-s-promptvalues","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/PromptLangfuse/PromptLangfuse.ts","lineNumber":76,"sourceCode":"\n        const langfuse = new Langfuse({\n            secretKey: langFuseSecretKey,\n            publicKey: langFusePublicKey,\n            baseUrl: langFuseEndpoint ?? 'https://cloud.langfuse.com',\n            sdkIntegration: 'Flowise'\n        })\n\n        const langfusePrompt = await langfuse.getPrompt(nodeData.inputs?.template as string)\n        let template = langfusePrompt.getLangchainPrompt()\n\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":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/prompts/PromptLangfuse/PromptLangfuse.ts#L58-L94","documentation":"PromptLangfuse.init fetches a prompt from Langfuse then parses `nodeData.inputs?.promptValues` as JSON. If the values string is malformed, JSON.parse throws and is rethrown with this message. Note the message labels it 'PromptTemplate' which is slightly misleading for the Langfuse variant.","triggerScenarios":"User supplies promptValues as a non-JSON string alongside a Langfuse-managed prompt; Langfuse returns a template with placeholders the user tries to fill via a malformed JSON blob.","commonSituations":"Mixing Langfuse-hosted prompts with locally typed prompt values; pasting values from a different prompt system that uses non-JSON syntax.","solutions":["Provide promptValues as valid JSON with double-quoted keys.","Pass an object from an upstream node to bypass JSON.parse.","Cross-check placeholder names against the Langfuse prompt via `getInputVariables(template)`.","Fix the misleading message text to say 'PromptLangfuse'."],"exampleFix":"// before\nthrow new Error(\"Invalid JSON in the PromptTemplate's promptValues: \" + exception)\n// after\nthrow new Error(`Invalid JSON in PromptLangfuse promptValues: ${exception instanceof Error ? exception.message : exception}. Input: ${promptValuesStr.slice(0,120)}`)","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(`PromptLangfuse 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 for promptValues.","Cross-check placeholder names against the Langfuse prompt.","Pass objects when possible."],"tags":["json","validation","prompt","langfuse"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}