FlowiseAI/Flowise · error · Error
Invalid modifier: ${part}
Error message
Invalid modifier: ${part} What it means
In parseZodType, every modifier segment (the 3rd and later dotted parts of a chained call) must match /^(\w+)(\(.*\))?$/. This throws on malformed modifier syntax such as a trailing dot producing an empty segment ('z.string().'), an unclosed paren ('z.string().max(500'), or symbols inside a modifier name.
Source
Thrown at packages/components/src/secureZodParser.ts:222
if (i === 1) {
// Second part is the base type
const baseMatch = part.match(/^(\w+)(\(.*\))?$/)
if (!baseMatch) {
throw new Error(`Invalid base type: ${part}`)
}
type.base = baseMatch[1]
if (baseMatch[2]) {
// Parse arguments for base type (e.g., enum values)
const args = this.parseArguments(baseMatch[2])
type.baseArgs = args
}
} else {
// Subsequent parts are modifiers
const modMatch = part.match(/^(\w+)(\(.*\))?$/)
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')
}View on GitHub (pinned to abe4a8601a)
Solutions
- Ensure each modifier is 'name' or 'name(args)' with balanced parentheses and no stray characters.
- Remove trailing dots; every '.' must be followed by a modifier identifier.
Example fix
// before
'z.object({ n: z.string().max(500 })'
// after
'z.object({ n: z.string().max(500) })' Defensive patterns
Strategy: validation
Validate before calling
function modifiersWellFormed(value: string): boolean {
const parts = value.split('.')
return parts.slice(2).every((p) => /^\w+(\(.*\))?$/.test(p.trim()))
} Prevention
- Ensure every modifier is 'name' or 'name(args)' with balanced parens.
- Avoid trailing dots; every '.' must be followed by a modifier identifier.
When it happens
Trigger: 'z.string().' (trailing dot), 'z.string().max(500' (unclosed paren), 'z.string().@max(500)'.
Common situations: Manual editing that drops a closing ')'; concatenating modifier strings programmatically and leaving a dangling '.'.
Related errors
- Failed to parse Zod schema: ${error.message}
- Schema must start with z.object()
- Invalid z.object() syntax
- Invalid object syntax
- Expected 'z' but got '${part}'
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/a3ad6fc1f0f4f5a3.
Report an issue: GitHub.