FlowiseAI/Flowise · error · Error

Invalid JSON in the PromptTemplate's promptValues: ${excepti

Error message

Invalid JSON in the PromptTemplate's promptValues: ${exception}

What it means

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.

Source

Thrown at packages/components/nodes/prompts/PromptLangfuse/PromptLangfuse.ts:76

        const langfuse = new Langfuse({
            secretKey: langFuseSecretKey,
            publicKey: langFusePublicKey,
            baseUrl: langFuseEndpoint ?? 'https://cloud.langfuse.com',
            sdkIntegration: 'Flowise'
        })

        const langfusePrompt = await langfuse.getPrompt(nodeData.inputs?.template as string)
        let template = langfusePrompt.getLangchainPrompt()

        const promptValuesStr = nodeData.inputs?.promptValues

        let promptValues: ICommonObject = {}
        if (promptValuesStr) {
            try {
                promptValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)
            } catch (exception) {
                throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception)
            }
        }

        const inputVariables = getInputVariables(template)
        template = transformBracesWithColon(template)

        try {
            const options: PromptTemplateInput = {
                template,
                inputVariables
            }
            const prompt = new PromptTemplate(options)
            prompt.promptValues = promptValues
            return prompt
        } catch (e) {
            throw new Error(e)
        }
    }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Provide promptValues as valid JSON with double-quoted keys.
  2. Pass an object from an upstream node to bypass JSON.parse.
  3. Cross-check placeholder names against the Langfuse prompt via `getInputVariables(template)`.
  4. Fix the misleading message text to say 'PromptLangfuse'.

Example fix

// before
throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception)
// after
throw new Error(`Invalid JSON in PromptLangfuse promptValues: ${exception instanceof Error ? exception.message : exception}. Input: ${promptValuesStr.slice(0,120)}`)
Defensive patterns

Strategy: validation

Validate before calling

function parsePromptValues(input: unknown): ICommonObject {
  if (input == null) return {}
  if (typeof input === 'object') return input as ICommonObject
  try { return JSON.parse(input) }
  catch (e) { throw new Error(`PromptLangfuse promptValues invalid JSON: ${(e as Error).message}`) }
}

Type guard

const isPlainObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v)

Prevention

When it happens

Trigger: 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.

Common situations: Mixing Langfuse-hosted prompts with locally typed prompt values; pasting values from a different prompt system that uses non-JSON syntax.

Understand the failure class

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/37fda34b75ba63d6. Report an issue: GitHub.