FlowiseAI/Flowise · error · Error

Unsupported base type: ${typeInfo.base}

Error message

Unsupported base type: ${typeInfo.base}

What it means

The default branch of buildZodSchema's switch, hit when the parsed base type is not one of the primitive cases the builder constructs (string, number, boolean, date, enum). Although the base already passed the ALLOWED_TYPES whitelist, only some whitelist entries are buildable as a base type; the rest (optional, max, min, describe, default, object, array) are modifier/container-only.

Source

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

            case 'number':
                zodType = z.number()
                break
            case 'boolean':
                zodType = z.boolean()
                break
            case 'date':
                zodType = z.date()
                break
            case 'enum':
                if (typeInfo.baseArgs && typeInfo.baseArgs[0] && Array.isArray(typeInfo.baseArgs[0])) {
                    const enumValues = typeInfo.baseArgs[0] as [string, ...string[]]
                    zodType = z.enum(enumValues)
                } else {
                    throw new Error('enum requires array of values')
                }
                break
            default:
                throw new Error(`Unsupported base type: ${typeInfo.base}`)
        }

        // Apply modifiers
        zodType = this.applyModifiers(zodType, typeInfo.modifiers || [])

        return zodType
    }

    private static applyModifiers(zodType: z.ZodTypeAny, modifiers: any[]): z.ZodTypeAny {
        for (const modifier of modifiers) {
            switch (modifier.name) {
                case 'int':
                    if (zodType._def?.typeName === 'ZodNumber') {
                        zodType = (zodType as z.ZodNumber).int()
                    }
                    break
                case 'max':
                    if (modifier.args[0] !== undefined) {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Lead every field with a primitive base type (`string`, `number`, `boolean`, `date`, or `enum([...])`) and chain modifiers after it.
  2. Use `z.string().optional()` rather than `z.optional()`.
  3. Re-read the schema string and confirm the first token of each field is a buildable base type.

Example fix

// before
const schema = "z.object({ name: z.optional() })"
// after
const schema = "z.object({ name: z.string().optional() })"
Defensive patterns

Strategy: validation

Validate before calling

const BASE_TYPES = ['string','number','boolean','date','enum']
function validateFieldBases(schemaStr: string): string[] {
  const issues: string[] = []
  for (const m of schemaStr.matchAll(/:\s*z\.([a-zA-Z_]\w*)/g)) {
    if (!BASE_TYPES.includes(m[1])) issues.push(`field base not buildable: ${m[1]}`)
  }
  return issues
}

Type guard

function isBuildableBase(base: string): boolean {
  return ['string','number','boolean','date','enum'].includes(base)
}

Try / catch

try {
  const schema = SecureZodSchemaParser.parseZodSchema(schemaStr)
} catch (e) {
  if (/Unsupported base type/.test(e.message)) {
    // ensure each field starts with a primitive base type
  }
  throw e
}

Prevention

When it happens

Trigger: A malformed schema where a modifier-only token or container token is parsed as the base, e.g. a field defined as `z.optional()`, `z.max(5)`, `z.default("x")`, or a bare `z.object(...)`/`z.array(...)` that was not routed through its dedicated build path.

Common situations: Hand-writing a schema and leading a field with a modifier instead of a base type; a parser edge case where a nested container is misclassified as a primitive base.

Related errors


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