{"record":{"id":"3b038ef82aaa6506","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-the-worker-s-prompt-input-values","errorCode":null,"errorMessage":"Invalid JSON in the Worker's Prompt Input Values: ${exception}","messagePattern":"Invalid JSON in the Worker's Prompt Input Values: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/multiagents/Worker/Worker.ts","lineNumber":106,"sourceCode":"        tools = flatten(tools)\n        let workerPrompt = nodeData.inputs?.workerPrompt as string\n        const workerLabel = nodeData.inputs?.workerName as string\n        const supervisor = nodeData.inputs?.supervisor as IMultiAgentNode\n        const maxIterations = nodeData.inputs?.maxIterations as string\n        const model = nodeData.inputs?.model as BaseChatModel\n        const promptValuesStr = nodeData.inputs?.promptValues\n\n        if (!workerLabel) throw new Error('Worker name is required!')\n        const workerName = workerLabel.toLowerCase().replace(/\\s/g, '_').trim()\n\n        if (!workerPrompt) throw new Error('Worker prompt is required!')\n\n        let workerInputVariablesValues: ICommonObject = {}\n        if (promptValuesStr) {\n            try {\n                workerInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)\n            } catch (exception) {\n                throw new Error(\"Invalid JSON in the Worker's Prompt Input Values: \" + exception)\n            }\n        }\n        workerInputVariablesValues = handleEscapeCharacters(workerInputVariablesValues, true)\n\n        const llm = model || (supervisor.llm as BaseChatModel)\n        const multiModalMessageContent = supervisor?.multiModalMessageContent || []\n\n        const abortControllerSignal = options.signal as AbortController\n        const workerInputVariables = getInputVariables(workerPrompt)\n\n        if (!workerInputVariables.every((element) => Object.keys(workerInputVariablesValues).includes(element))) {\n            throw new Error('Worker input variables values are not provided!')\n        }\n\n        const agent = await createAgent(\n            llm,\n            [...tools],\n            workerPrompt,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/multiagents/Worker/Worker.ts#L88-L124","documentation":"Thrown inside Worker.init's try/catch around `JSON.parse(promptValuesStr)`. The promptValues field accepts either an object or a JSON string of substitution values for the worker prompt template; if the string is malformed JSON, parse throws and is rethrown with this message.","triggerScenarios":"User types a non-JSON string (e.g. `name=John`), uses single quotes, leaves a trailing comma, or pastes a JS object literal into the promptValues field.","commonSituations":"Manually editing promptValues in the node UI; passing a templated string that didn't get JSON-encoded upstream; locale-specific quote characters copied from a word processor.","solutions":["Provide promptValues as valid JSON: `{\"key\": \"value\"}` with double quotes.","If passing an object from a previous node, leave it as an object — the code path `typeof promptValuesStr === 'object'` skips JSON.parse.","Run the JSON through a linter/validator before pasting.","Improve the error message to include the parse position from `exception.message`."],"exampleFix":"// before\nworkerInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)\n// after\nif (typeof promptValuesStr === 'string') {\n  try { workerInputVariablesValues = JSON.parse(promptValuesStr) }\n  catch (e) { throw new Error(`promptValues is not valid JSON at offset ${(e as Error).message}: got ${promptValuesStr.slice(0,80)}`) }\n} else {\n  workerInputVariablesValues = promptValuesStr\n}","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 as string) }\n  catch (e) { throw new Error(`promptValues invalid JSON: ${(e as Error).message}`) }\n}","typeGuard":"const isPlainObject = (v: unknown): v is Record<string, unknown> =>\n  typeof v === 'object' && v !== null && !Array.isArray(v)","tryCatchPattern":"try { workerInputVariablesValues = JSON.parse(promptValuesStr) }\ncatch (e) { throw new Error(`promptValues JSON parse failed: ${(e as Error).message}`) }","preventionTips":["Always use double-quoted JSON.","Pass objects between nodes instead of strings when possible.","Validate JSON in the UI before submission."],"tags":["json","validation","prompt","multiagent"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}