{"record":{"id":"d7d9567dd1663b60","repo":"FlowiseAI/Flowise","slug":"expected-z-but-got-part","errorCode":null,"errorMessage":"Expected 'z' but got '${part}'","messagePattern":"Expected 'z' but got '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/secureZodParser.ts","lineNumber":200,"sourceCode":"                    ...arrayResult,\n                    modifiers: arrayWithModifiers.modifiers\n                }\n            }\n            return this.parseArray(typeStr)\n        }\n\n        const type: { base: string; modifiers: any[]; baseArgs?: any[] } = { base: '', modifiers: [] }\n\n        // Handle chained methods like z.string().max(500).optional()\n        const parts = typeStr.split('.')\n\n        for (let i = 0; i < parts.length; i++) {\n            const part = parts[i].trim()\n\n            if (i === 0) {\n                // First part should be 'z'\n                if (part !== 'z') {\n                    throw new Error(`Expected 'z' but got '${part}'`)\n                }\n                continue\n            }\n\n            if (i === 1) {\n                // Second part is the base type\n                const baseMatch = part.match(/^(\\w+)(\\(.*\\))?$/)\n                if (!baseMatch) {\n                    throw new Error(`Invalid base type: ${part}`)\n                }\n\n                type.base = baseMatch[1]\n                if (baseMatch[2]) {\n                    // Parse arguments for base type (e.g., enum values)\n                    const args = this.parseArguments(baseMatch[2])\n                    type.baseArgs = args\n                }\n            } else {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/secureZodParser.ts#L182-L218","documentation":"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.","triggerScenarios":"'name: string()', 'name: y.string()', 'name: \"x\"', or any property value whose first dotted segment is not 'z'.","commonSituations":"Forgetting the 'z.' namespace prefix; using a custom schema builder variable; copy-paste from JS that destructured z.","solutions":["Prefix the type with 'z.', e.g. 'name: z.string()'.","Ensure the schema source uses the global 'z' identifier only."],"exampleFix":"// before\n'z.object({ name: string() })'\n\n// after\n'z.object({ name: z.string() })'","handlingStrategy":"validation","validationCode":"function firstSegmentIsZ(value: string): boolean {\n  const seg = value.split('.')[0]?.trim()\n  return seg === 'z'\n}","typeGuard":"const isZodPrefixed = (v: string): boolean => /^z\\./.test(v.trim())","tryCatchPattern":null,"preventionTips":["Always prefix property value types with 'z.'.","Do not use a custom builder variable; the parser only recognizes the 'z' namespace."],"tags":["zod","schema","parsing"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}