{"record":{"id":"2c5e9ba4fda5aaff","repo":"FlowiseAI/Flowise","slug":"received-tool-input-did-not-match-expected-schema-2c5e9b","errorCode":null,"errorMessage":"Received tool input did not match expected schema ${e}","messagePattern":"Received tool input did not match expected schema (.+?)","errorType":"validation","errorClass":"ToolInputParsingException","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/OpenAPIToolkit/core.ts","lineNumber":179,"sourceCode":"        this.strict = fields.strict\n        this.removeNulls = fields.removeNulls ?? false\n    }\n\n    async call(\n        arg: z.output<T>,\n        configArg?: RunnableConfig | Callbacks,\n        tags?: string[],\n        flowConfig?: { sessionId?: string; chatId?: string; input?: string; state?: ICommonObject }\n    ): Promise<string> {\n        const config = parseCallbackConfigArg(configArg)\n        if (config.runName === undefined) {\n            config.runName = this.name\n        }\n        let parsed\n        try {\n            parsed = await parseWithTypeConversion(this.schema, arg)\n        } catch (e) {\n            throw new ToolInputParsingException(`Received tool input did not match expected schema ${e}`, JSON.stringify(arg))\n        }\n        const callbackManager_ = await CallbackManager.configure(\n            config.callbacks,\n            this.callbacks,\n            config.tags || tags,\n            this.tags,\n            config.metadata,\n            this.metadata,\n            { verbose: this.verbose }\n        )\n        const runManager = await callbackManager_?.handleToolStart(\n            this.toJSON(),\n            typeof parsed === 'string' ? parsed : JSON.stringify(parsed),\n            undefined,\n            undefined,\n            undefined,\n            undefined,\n            config.runName","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/OpenAPIToolkit/core.ts#L161-L197","documentation":"Thrown as a ToolInputParsingException by OpenAPIToolkit/core.ts DynamicStructuredTool.call when parseWithTypeConversion(schema, arg) rejects the incoming argument against the tool's Zod schema. The exception message appends the Zod error and includes the serialized input as the second argument, signalling that the caller (typically an LLM agent) produced arguments that violate the generated tool schema for this OpenAPI endpoint.","triggerScenarios":"The LLM emits a JSON argument missing a required field, with a wrong type (e.g. string where a number is expected), or with extra unknown fields when strict mode is on; the agent sends a plain string where an object is expected; enum constraint violated.","commonSituations":"Loosely-prompted agent generates best-effort arguments that do not match the endpoint schema; the OpenAPI spec declares a parameter as required but the model omits it; a recent spec change tightened the schema and stale agent behavior breaks; strict:true causing extra-property rejection.","solutions":["Inspect the Zod error embedded in the message to find the failing field and constraint.","Correct the tool-call argument to satisfy the schema (right types, required fields present, valid enum values).","If extra properties are rejected, either remove them from the agent output or disable strict mode on the tool.","Improve the tool/parameter descriptions in the spec so the LLM supplies conformant arguments.","Retry the agent turn with the error fed back so it self-corrects."],"exampleFix":"// before: agent omitted required field\nawait tool.call({ query: 'foo' })  // schema requires { query: string, limit: number }\n// after\nawait tool.call({ query: 'foo', limit: 10 })","handlingStrategy":"try-catch","validationCode":"import { safeParseTyped } from 'zod/v3'\n// pre-validate against the tool's schema before calling\nfunction matchesSchema(schema: any, arg: unknown): boolean {\n  return schema.safeParse(arg).success === true\n}","typeGuard":"null","tryCatchPattern":"import { ToolInputParsingException } from '../OpenAPIToolkit/core'\ntry {\n  await tool.call(arg)\n} catch (e) {\n  if (e instanceof ToolInputParsingException) {\n    // parse the embedded Zod error, feed back to the agent for retry\n  } else throw e\n}","preventionTips":["Improve parameter descriptions in the spec so the LLM emits conformant args.","Run schema.safeParse(arg) before calling and report issues to the agent.","If extra fields are rejected, disable strict mode on the tool.","After spec changes, re-test agent tool calls end-to-end."],"tags":["openapi","schema","zod","agent-input","validation"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}