{"record":{"id":"379ddde5a4e33041","repo":"FlowiseAI/Flowise","slug":"invalid-object-syntax","errorCode":null,"errorMessage":"Invalid object syntax","messagePattern":"Invalid object syntax","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/secureZodParser.ts","lineNumber":146,"sourceCode":"    private static parseProperty(prop: string): [string | null, any] {\n        const colonIndex = prop.indexOf(':')\n        if (colonIndex === -1) return [null, null]\n\n        const key = prop.substring(0, colonIndex).trim().replace(/['\"]/g, '')\n        const value = prop.substring(colonIndex + 1).trim()\n\n        return [key, this.parseZodType(value)]\n    }\n\n    private static parseZodType(typeStr: string): any {\n        // Check if this is a nested object (not in an array)\n        if (typeStr.startsWith('z.object(') && !typeStr.startsWith('z.array(')) {\n            // Check if there are modifiers after the object\n            const objectWithModifiers = this.extractObjectWithModifiers(typeStr)\n            if (objectWithModifiers.hasModifiers) {\n                const objectMatch = objectWithModifiers.objectPart.match(/z\\.object\\(\\s*\\{([\\s\\S]*)\\}\\s*\\)/)\n                if (!objectMatch) {\n                    throw new Error('Invalid object syntax')\n                }\n\n                const objectContent = objectMatch[1]\n                const objectProperties = this.parseObjectProperties(objectContent)\n\n                return {\n                    isNestedObject: true,\n                    objectSchema: objectProperties,\n                    modifiers: objectWithModifiers.modifiers\n                }\n            }\n\n            // Original code for objects without modifiers\n            const objectMatch = typeStr.match(/z\\.object\\(\\s*\\{([\\s\\S]*)\\}\\s*\\)/)\n            if (!objectMatch) {\n                throw new Error('Invalid object syntax')\n            }\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/secureZodParser.ts#L128-L164","documentation":"When a property value is a nested z.object(...) followed by modifiers (e.g. '.optional()'), extractObjectWithModifiers splits off the object part; if that object part still does not match /z\\.object\\(\\s*\\{([\\s\\S]*)\\}\\s*\\)/, this throws. It indicates a nested object that has modifiers AND a malformed/missing brace body.","triggerScenarios":"'addr: z.object().optional()' (nested object with no body + modifier), or a nested object with unbalanced braces followed by '.optional()' / '.default(...)'.","commonSituations":"Marking an optional nested object but forgetting its body; copy-paste that drops the inner '{}'.","solutions":["Give the nested object a complete brace body: 'addr: z.object({ city: z.string() }).optional()'.","Ensure braces are balanced before any trailing modifier."],"exampleFix":"// before\n'z.object({ addr: z.object().optional() })'\n\n// after\n'z.object({ addr: z.object({ city: z.string() }).optional() })'","handlingStrategy":"validation","validationCode":"// For nested-object-with-modifier values, ensure the object part has a brace body.\nconst validNestedObjWithMod = (v: string): boolean => {\n  const m = v.match(/^(z\\.object\\(\\s*\\{[\\s\\S]*?\\}\\s*\\))\\..+$/)\n  return !!m\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give nested objects a complete brace body before any modifier.","Use 'prop: z.object({...}).optional()' rather than 'z.object().optional()'."],"tags":["zod","schema","parsing","nested-object"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}