FlowiseAI/Flowise · error · Error
Key is required
Error message
Key is required
What it means
Thrown in the JSON-schema branch of `getUpdateStateMemory` (`updateStateMemory` tab) when iterating `parsedSchema` and a row has no `Key` field. Each row must produce a state memory entry keyed by `Key`, so an empty key is rejected before merging into state.
Source
Thrown at packages/components/nodes/sequentialagents/Agent/Agent.ts:905
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
- Ensure every entry in the `updateStateMemory` array has a non-empty `Key` property.
- Use the UI tab (updateStateMemoryUI) instead of raw JSON so keys are validated by the form.
- Run a preflight check filtering rows without keys before submitting the node config.
Example fix
// before
nodeData.inputs.updateStateMemory = '[{"Value":"Alice"}]' // throws [286]
// after
nodeData.inputs.updateStateMemory = '[{"Key":"userName","Value":"Alice"}]' Defensive patterns
Strategy: validation
Validate before calling
function validateStateMemorySchema(schema) {
const arr = typeof schema === 'string' ? JSON.parse(schema) : schema
if (!Array.isArray(arr)) throw new Error('updateStateMemory must be a JSON array')
for (const row of arr) {
if (!row.Key) throw new Error(`Row is missing a Key: ${JSON.stringify(row)}`)
}
return arr
}
validateStateMemorySchema(nodeData.inputs.updateStateMemory) Type guard
function isStateMemoryRow(v): v is { Key: string; Value: unknown } {
return v != null && typeof v === 'object' && typeof (v as any).Key === 'string' && (v as any).Key.length > 0
} Prevention
- Prefer the UI grid tab over raw JSON so keys are enforced.
- Always fill the Key field before adding another row.
- Validate the array with JSON.parse before saving the node.
When it happens
Trigger: Passing `updateStateMemory` as a JSON array where one or more entries lack the `Key` property or have an empty string — e.g. `[{"Value":"x"}]`.
Common situations: User added a state-memory row in the JSON tab but forgot to fill the Key; renamed the column externally; partial copy-paste left a row with only a Value.
Related errors
- Invalid JSON in the Agent's Prompt Input Values: ${exception
- Agent input variables values are not provided!
- Return output must be an object
- Condition variable is required!
- Invalid JSON in the Condition Agent's Prompt Input Values: $
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/fb739dabf6cd8610.
Report an issue: GitHub.