{"record":{"id":"04d94d5b3c4af5e7","repo":"FlowiseAI/Flowise","slug":"invalid-z-object-syntax","errorCode":null,"errorMessage":"Invalid z.object() syntax","messagePattern":"Invalid z\\.object\\(\\) syntax","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/secureZodParser.ts","lineNumber":68,"sourceCode":"\n        // Normalize whitespace\n        schema = schema.replace(/\\s+/g, ' ').trim()\n\n        return schema\n    }\n\n    private static parseSchemaStructure(schema: string): any {\n        // This is a simplified parser that handles common Zod patterns safely\n        // It does NOT use eval/Function and only handles predefined safe patterns\n\n        if (!schema.startsWith('z.object(')) {\n            throw new Error('Schema must start with z.object()')\n        }\n\n        // Extract the object content\n        const objectMatch = schema.match(/z\\.object\\(\\s*\\{([\\s\\S]*)\\}\\s*\\)/)\n        if (!objectMatch) {\n            throw new Error('Invalid z.object() syntax')\n        }\n\n        const objectContent = objectMatch[1]\n        return this.parseObjectProperties(objectContent)\n    }\n\n    private static parseObjectProperties(content: string): Record<string, any> {\n        const properties: Record<string, any> = {}\n\n        // Split by comma, but handle nested structures\n        const props = this.splitProperties(content)\n\n        for (const prop of props) {\n            const [key, value] = this.parseProperty(prop)\n            if (key && value) {\n                properties[key] = value\n            }\n        }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/secureZodParser.ts#L50-L86","documentation":"The cleaned schema starts with 'z.object(' but the regex /z\\.object\\(\\s*\\{([\\s\\S]*)\\}\\s*\\)/ fails to match — i.e. there is no '{ ... }' body. This fires for z.object() with no braces, z.object(null), z.object(123), or any z.object whose argument is not a brace-wrapped object literal.","triggerScenarios":"'z.object()', 'z.object(null)', 'z.object(123)', or a body where the opening '{' or closing '}' is missing.","commonSituations":"Trying to define an empty object schema without braces; passing a variable reference as the object argument.","solutions":["Always provide a brace-wrapped body, even when empty: 'z.object({})'.","Ensure the closing '})' is present."],"exampleFix":"// before\n'z.object()'\n\n// after\n'z.object({})'","handlingStrategy":"validation","validationCode":"const hasObjectBody = (s: string): boolean => /z\\.object\\(\\s*\\{[\\s\\S]*\\}\\s*\\)/.test(s)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a brace-wrapped body, even when empty: z.object({}).","Do not pass null/numbers/variables as the z.object argument."],"tags":["zod","schema","parsing"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}