FlowiseAI/Flowise · error · Error
Invalid array syntax
Error message
Invalid array syntax
What it means
parseArray requires the input to match /z\.array\(\s*([\s\S]*)\s*\)$/ — the string must END with ')' after the array content. This throws when the array call is unbalanced or does not terminate with a closing paren, e.g. 'z.array(z.string()' (missing close) or content that swallows the terminator.
Source
Thrown at packages/components/src/secureZodParser.ts:239
if (!modMatch) {
throw new Error(`Invalid modifier: ${part}`)
}
const modName = modMatch[1]
const modArgs = modMatch[2] ? this.parseArguments(modMatch[2]) : []
type.modifiers.push({ name: modName, args: modArgs })
}
}
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)View on GitHub (pinned to abe4a8601a)
Solutions
- Balance the parentheses so the array call ends with ')'.
- For nested arrays, count opening and closing parens to ensure they match.
Example fix
// before
'z.object({ tags: z.array(z.string() })'
// after
'z.object({ tags: z.array(z.string()) })' Defensive patterns
Strategy: validation
Validate before calling
const validArrayCall = (v: string): boolean => /z\.array\(\s*[\s\S]*\s*\)$/.test(v)
Prevention
- Balance parentheses so the array call ends with ')'.
- Count parens for nested arrays to avoid swallowing the terminator.
When it happens
Trigger: 'z.array(z.string()' (missing ')'), 'z.array(z.string()]' (wrong bracket), or any z.array whose final ')' is missing.
Common situations: Truncating a schema string; nested arrays where parens are miscounted.
Related errors
- Invalid object syntax inside array
- Failed to parse Zod schema: ${error.message}
- Schema must start with z.object()
- Invalid z.object() syntax
- Invalid object syntax
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/4b3e7a37bf6182e2.
Report an issue: GitHub.