FlowiseAI/Flowise · error · Error

Key is required

Error message

Key is required

What it means

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).

Source

Thrown at packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts:679

    const variables = await getVars(appDataSource, databaseEntities, nodeData, options)

    const flow = {
        chatflowId: options.chatflowid,
        sessionId: options.sessionId,
        chatId: options.chatId,
        input,
        output,
        state,
        vars: prepareSandboxVars(variables)
    }

    if (updateStateMemory && updateStateMemory !== 'updateStateMemoryUI' && updateStateMemory !== 'updateStateMemoryCode') {
        try {
            const parsedSchema = typeof updateStateMemory === 'string' ? JSON.parse(updateStateMemory) : updateStateMemory
            const obj: ICommonObject = {}
            for (const sch of parsedSchema) {
                const key = sch.Key
                if (!key) throw new Error(`Key is required`)
                let value = sch.Value as string
                if (value.startsWith('$flow')) {
                    value = customGet(flow, sch.Value.replace('$flow.', ''))
                } else if (value.startsWith('$vars')) {
                    value = customGet(flow, sch.Value.replace('$', ''))
                }
                obj[key] = value
            }
            return obj
        } catch (e) {
            throw new Error(e)
        }
    }

    if (selectedTab === 'updateStateMemoryUI' && updateStateMemoryUI) {
        try {
            const parsedSchema = typeof updateStateMemoryUI === 'string' ? JSON.parse(updateStateMemoryUI) : updateStateMemoryUI
            const obj: ICommonObject = {}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Fill in a non-empty Key for every row in the Update State Memory grid.
  2. Delete any empty/placeholder rows.
  3. Note this is the legacy capital-Key schema; if you intended the current UI, use the 'updateStateMemoryUI' tab (see error 318).

Example fix

// before (throws: second row has empty Key)
[{"Key":"topic","Value":"rag"},{"Key":"","Value":"x"}]

// after
[{"Key":"topic","Value":"rag"},{"Key":"label","Value":"x"}]
Defensive patterns

Strategy: validation

Validate before calling

const rows = (typeof updateStateMemory === 'string' ? JSON.parse(updateStateMemory) : updateStateMemory) as {Key?:string;Value?:unknown}[]
for (const r of rows) if (!r.Key) throw new Error('Every Update State Memory row needs a non-empty Key')

Type guard

const isLegacyStateRow = (x: any): x is {Key:string;Value:unknown} =>
  !!x && typeof x === 'object' && typeof x.Key === 'string' && x.Key.length > 0

Prevention

When it happens

Trigger: updateStateMemory is a JSON array (or string) of {Key, Value} objects and at least one row has Key '' or omits Key entirely.

Common situations: 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.

Related errors


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