FlowiseAI/Flowise · error · Error

Invalid object syntax inside array

Error message

Invalid object syntax inside array

What it means

Inside parseArray, when the array content starts with 'z.object(' but its body does not match /z\.object\(\s*\{([\s\S]*)\}\s*\)/ (missing or malformed '{}'), this throws. It is the array counterpart of error 611: an array whose element type is an object literal without a valid brace body.

Source

Thrown at packages/components/src/secureZodParser.ts:249

        return type
    }

    private static parseArray(typeStr: string): any {
        // Extract the content inside array()
        const arrayContentMatch = typeStr.match(/z\.array\(\s*([\s\S]*)\s*\)$/)
        if (!arrayContentMatch) {
            throw new Error('Invalid array syntax')
        }

        const arrayContent = arrayContentMatch[1].trim()

        // Parse the object inside the array
        if (arrayContent.startsWith('z.object(')) {
            // Extract object content
            const objectMatch = arrayContent.match(/z\.object\(\s*\{([\s\S]*)\}\s*\)/)
            if (!objectMatch) {
                throw new Error('Invalid object syntax inside array')
            }

            const objectContent = objectMatch[1]
            const objectProperties = this.parseObjectProperties(objectContent)

            // Validate each property in the nested object
            for (const propValue of Object.values(objectProperties)) {
                this.validateTypeInfo(propValue)
            }

            return {
                isArrayOfObjects: true,
                objectSchema: objectProperties
            }
        }

        // Handle simple arrays (e.g., z.array(z.string()))
        const innerType = this.parseZodType(arrayContent)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Give the array's element object a brace-wrapped body, e.g. 'z.array(z.object({ id: z.string() }))'.

Example fix

// before
'z.object({ items: z.array(z.object()) })'

// after
'z.object({ items: z.array(z.object({ id: z.string() })) })'
Defensive patterns

Strategy: validation

Validate before calling

const validObjectInArray = (v: string): boolean =>
  /z\.array\(\s*z\.object\(\s*\{[\s\S]*\}\s*\)\s*\)$/.test(v)

Prevention

When it happens

Trigger: 'z.array(z.object())' or 'z.array(z.object(null))'.

Common situations: Defining an array of empty objects without braces; referencing a variable as the element object.

Related errors


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