FlowiseAI/Flowise · error · Error
Expected 'z' but got '${part}'
Error message
Expected 'z' but got '${part}' What it means
For a non-object/non-array property value, parseZodType splits the dotted chain on '.' and requires the first segment to be the literal 'z'. This throws when a value does not start with 'z.' — e.g. 'string()', 'y.string()', or a bare literal/identifier.
Source
Thrown at packages/components/src/secureZodParser.ts:200
...arrayResult,
modifiers: arrayWithModifiers.modifiers
}
}
return this.parseArray(typeStr)
}
const type: { base: string; modifiers: any[]; baseArgs?: any[] } = { base: '', modifiers: [] }
// Handle chained methods like z.string().max(500).optional()
const parts = typeStr.split('.')
for (let i = 0; i < parts.length; i++) {
const part = parts[i].trim()
if (i === 0) {
// First part should be 'z'
if (part !== 'z') {
throw new Error(`Expected 'z' but got '${part}'`)
}
continue
}
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 {View on GitHub (pinned to abe4a8601a)
Solutions
- Prefix the type with 'z.', e.g. 'name: z.string()'.
- Ensure the schema source uses the global 'z' identifier only.
Example fix
// before
'z.object({ name: string() })'
// after
'z.object({ name: z.string() })' Defensive patterns
Strategy: validation
Validate before calling
function firstSegmentIsZ(value: string): boolean {
const seg = value.split('.')[0]?.trim()
return seg === 'z'
} Type guard
const isZodPrefixed = (v: string): boolean => /^z\./.test(v.trim())
Prevention
- Always prefix property value types with 'z.'.
- Do not use a custom builder variable; the parser only recognizes the 'z' namespace.
When it happens
Trigger: 'name: string()', 'name: y.string()', 'name: "x"', or any property value whose first dotted segment is not 'z'.
Common situations: Forgetting the 'z.' namespace prefix; using a custom schema builder variable; copy-paste from JS that destructured z.
Related errors
- Failed to parse Zod schema: ${error.message}
- Schema must start with z.object()
- Invalid z.object() syntax
- Invalid object syntax
- Invalid base type: ${part}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/d7d9567dd1663b60.
Report an issue: GitHub.