{"record":{"id":"e52af8234bb6072a","repo":"FlowiseAI/Flowise","slug":"key-is-required-e52af8","errorCode":null,"errorMessage":"Key is required","messagePattern":"Key is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts","lineNumber":679,"sourceCode":"    const variables = await getVars(appDataSource, databaseEntities, nodeData, options)\n\n    const flow = {\n        chatflowId: options.chatflowid,\n        sessionId: options.sessionId,\n        chatId: options.chatId,\n        input,\n        output,\n        state,\n        vars: prepareSandboxVars(variables)\n    }\n\n    if (updateStateMemory && updateStateMemory !== 'updateStateMemoryUI' && updateStateMemory !== 'updateStateMemoryCode') {\n        try {\n            const parsedSchema = typeof updateStateMemory === 'string' ? JSON.parse(updateStateMemory) : updateStateMemory\n            const obj: ICommonObject = {}\n            for (const sch of parsedSchema) {\n                const key = sch.Key\n                if (!key) throw new Error(`Key is required`)\n                let value = sch.Value as string\n                if (value.startsWith('$flow')) {\n                    value = customGet(flow, sch.Value.replace('$flow.', ''))\n                } else if (value.startsWith('$vars')) {\n                    value = customGet(flow, sch.Value.replace('$', ''))\n                }\n                obj[key] = value\n            }\n            return obj\n        } catch (e) {\n            throw new Error(e)\n        }\n    }\n\n    if (selectedTab === 'updateStateMemoryUI' && updateStateMemoryUI) {\n        try {\n            const parsedSchema = typeof updateStateMemoryUI === 'string' ? JSON.parse(updateStateMemoryUI) : updateStateMemoryUI\n            const obj: ICommonObject = {}","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts#L661-L697","documentation":"In getReturnOutput, the legacy 'Update State Memory' path parses a schema whose rows use capital {Key, Value}. Each row must have a non-empty Key because the key becomes a state property name. An empty/missing Key on any row throws. This branch handles the older capital-key schema (distinct from the lowercase-key UI tab).","triggerScenarios":"updateStateMemory is a JSON array (or string) of {Key, Value} objects and at least one row has Key '' or omits Key entirely.","commonSituations":"Adding a row to the state-memory grid and leaving the Key column blank before save; a serialized schema that lost a key during import; mixing the legacy capital-key schema with rows intended for the lowercase-key UI.","solutions":["Fill in a non-empty Key for every row in the Update State Memory grid.","Delete any empty/placeholder rows.","Note this is the legacy capital-Key schema; if you intended the current UI, use the 'updateStateMemoryUI' tab (see error 318)."],"exampleFix":"// before (throws: second row has empty Key)\n[{\"Key\":\"topic\",\"Value\":\"rag\"},{\"Key\":\"\",\"Value\":\"x\"}]\n\n// after\n[{\"Key\":\"topic\",\"Value\":\"rag\"},{\"Key\":\"label\",\"Value\":\"x\"}]","handlingStrategy":"validation","validationCode":"const rows = (typeof updateStateMemory === 'string' ? JSON.parse(updateStateMemory) : updateStateMemory) as {Key?:string;Value?:unknown}[]\nfor (const r of rows) if (!r.Key) throw new Error('Every Update State Memory row needs a non-empty Key')","typeGuard":"const isLegacyStateRow = (x: any): x is {Key:string;Value:unknown} =>\n  !!x && typeof x === 'object' && typeof x.Key === 'string' && x.Key.length > 0","tryCatchPattern":null,"preventionTips":["Fill the Key column for every row before saving.","Delete placeholder/empty rows.","Remember this path uses capital-Key schema; use the UI tab for lowercase keys."],"tags":["llm-node","state-memory","validation","runtime"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}