{"record":{"id":"1f055396c6e39eb6","repo":"mastra-ai/mastra","slug":"input-data-not-found","errorCode":null,"errorMessage":"Input data not found","messagePattern":"Input data not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent-builder/src/defaults.ts","lineNumber":284,"sourceCode":"});\n\\`\\`\\`\n\n### Weather Workflow\n\\`\\`\\`\n// ./src/workflows/weather-workflow.ts\nimport { createStep, createWorkflow } from '@mastra/core/workflows';\nimport { z } from 'zod';\n\nconst fetchWeather = createStep({\n  id: 'fetch-weather',\n  description: 'Fetches weather forecast for a given city',\n  inputSchema: z.object({\n    city: z.string().describe('The city to get the weather for'),\n  }),\n  outputSchema: forecastSchema,\n  execute: async (inputData) => {\n    if (!inputData) {\n      throw new Error('Input data not found');\n    }\n\n    const geocodingUrl = \\`https://geocoding-api.open-meteo.com/v1/search?name=\\${encodeURIComponent(inputData.city)}&count=1\\`;\n    const geocodingResponse = await fetch(geocodingUrl);\n    const geocodingData = (await geocodingResponse.json()) as {\n      results: { latitude: number; longitude: number; name: string }[];\n    };\n\n    if (!geocodingData.results?.[0]) {\n      throw new Error(\\`Location '\\${inputData.city}' not found\\`);\n    }\n\n    const { latitude, longitude, name } = geocodingData.results[0];\n\n    const weatherUrl = \\`https://api.open-meteo.com/v1/forecast?latitude=\\${latitude}&longitude=\\${longitude}&current=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m\\`\n    const response = await fetch(weatherUrl);\n    const data = (await response.json()) as {\n      current: {","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/agent-builder/src/defaults.ts#L266-L302","documentation":"The default weather tool's execute() in AgentBuilderDefaults throws 'Input data not found' when inputData is falsy. The tool has an inputSchema requiring a 'city' string, but Mastra passes inputData explicitly and it can be missing/undefined when the workflow step is invoked without input. This is a defensive guard inside the built-in demo tool shipped with the agent builder defaults.","triggerScenarios":"Triggering the default weather workflow step whose input schema is { city: string } with undefined/null inputData — e.g. a workflow run started without a trigger payload, a step wired so its input mapping produces nothing, or an agent/tool invocation that bypasses schema validation.","commonSituations":"Running the scaffolded weather workflow without providing a triggerData object; editing the workflow so the step's input reference no longer resolves; calling the tool programmatically with no argument; older/newer core versions changing how inputData is injected into step execute.","solutions":["Start the workflow with a trigger payload matching the inputSchema, e.g. { city: 'London' }","Verify the step's input wiring so inputData flows from the previous step or trigger","If calling the tool directly, always pass { city: '...' } as the argument","Upgrade @mastra/core so schema validation runs before execute and rejects empty input earlier"],"exampleFix":"// before\nconst result = await mastra.getWorkflow('weatherWorkflow').start();\n\n// after\nconst result = await mastra.getWorkflow('weatherWorkflow').start({\n  triggerData: { city: 'San Francisco' },\n});","handlingStrategy":"validation","validationCode":"const trigger = { city: 'London' };\nif (!trigger || typeof trigger.city !== 'string' || trigger.city.length === 0) {\n  throw new Error('city is required before starting weather workflow');\n}\nawait mastra.getWorkflow('weatherWorkflow').start({ triggerData: trigger });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass triggerData matching the step inputSchema when starting the workflow","Let zod inputSchema validation surface issues instead of bypassing the schema","Check step wiring in Studio after editing workflows"],"tags":["workflow","input-validation","agent-builder"],"backgroundTag":"missing-required-input","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}