FlowiseAI/Flowise · error · Error

Key prefix cannot contain "${KEY_SEPARATOR}" character

Error message

Key prefix cannot contain "${KEY_SEPARATOR}" character

What it means

Thrown in init() when a non-empty keyPrefix contains the literal '#' character, which is reserved as KEY_SEPARATOR. The tool composes DynamoDB partition keys as `${keyPrefix}#${key}`, so an embedded '#' would corrupt the prefix/key boundary and cause silent collisions or unreachable records. Validation happens once at construction, never at query time.

Source

Thrown at packages/components/nodes/tools/AWSDynamoDBKVStorage/AWSDynamoDBKVStorage.ts:365

            }
        }
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const credentials = await getAWSCredentials(nodeData, options)

        const region = (nodeData.inputs?.region as string) || DEFAULT_AWS_REGION
        const tableName = nodeData.inputs?.tableName as string
        const keyPrefix = (nodeData.inputs?.keyPrefix as string) || ''
        const operation = (nodeData.inputs?.operation as string) || Operation.STORE

        if (!tableName || tableName === ERROR_PLACEHOLDER) {
            throw new Error('Valid DynamoDB Table selection is required')
        }

        // Validate key prefix doesn't contain separator
        if (keyPrefix && keyPrefix.includes(KEY_SEPARATOR)) {
            throw new Error(`Key prefix cannot contain "${KEY_SEPARATOR}" character`)
        }

        const dynamoClient = createDynamoDBClient(credentials, region)

        if (operation === Operation.STORE) {
            return new DynamoDBStoreTool(dynamoClient, tableName, keyPrefix)
        } else {
            return new DynamoDBRetrieveTool(dynamoClient, tableName, keyPrefix)
        }
    }
}

module.exports = { nodeClass: AWSDynamoDBKVStorage_Tools }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Strip or replace '#' in the intended prefix before saving the node (e.g. 'tenant#prod' -> 'tenant_prod').
  2. If hierarchical prefixes are needed, encode them with a different delimiter ('_', '-', '.') since '#' is hard-reserved.
  3. Add a UI-level input validator on keyPrefix so the user is warned before init() runs.

Example fix

// before
const keyPrefix = (nodeData.inputs?.keyPrefix as string) || 'tenant#prod'
// after
const keyPrefix = ((nodeData.inputs?.keyPrefix as string) || '').replace(/#/g, '_')
Defensive patterns

Strategy: validation

Validate before calling

const KEY_SEPARATOR = '#'
function sanitizeKeyPrefix(prefix: string): string {
  if (prefix.includes(KEY_SEPARATOR)) {
    throw new Error(`Key prefix cannot contain "${KEY_SEPARATOR}"; got: ${prefix}`)
  }
  return prefix
}

Type guard

function isSafeKeyPrefix(prefix: unknown, sep = '#'): prefix is string {
  return typeof prefix === 'string' && (!prefix || !prefix.includes(sep))
}

Prevention

When it happens

Trigger: Entering a keyPrefix like 'tenant#prod', 'env#staging', or any value copied from a path that uses '#' as a delimiter; using URL fragments or namespace strings verbatim as a prefix.

Common situations: Reusing an existing resource-name convention (e.g. 'app#v2') as the prefix without realizing the tool reserves '#'; migrating from another KV store that allowed '#'; copy-paste from a config file that uses '#' for comments inadvertently.

Related errors


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