{"record":{"id":"b328c2f59f701f3f","repo":"Budibase/budibase","slug":"exa-error-response-status-response-statustex","errorCode":null,"errorMessage":"Exa error: ${response.status} ${response.statusText} - ${errorBody}","messagePattern":"Exa error: (.+?) (.+?) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/ai/tools/search/exa.ts","lineNumber":45,"sourceCode":"  tool: tool({\n    description: \"Search the web using Exa\",\n    inputSchema: exaSearchParams,\n    execute: async args => {\n      const response = await fetch(\"https://api.exa.ai/search\", {\n        method: \"POST\",\n        headers: {\n          Authorization: `Bearer ${apiKey}`,\n          \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify({\n          query: args.query,\n          num_results: args.num_results,\n        }),\n      })\n\n      if (!response.ok) {\n        const errorBody = await response.text()\n        throw new Error(\n          `Exa error: ${response.status} ${response.statusText} - ${errorBody}`\n        )\n      }\n      return response.json()\n    },\n  }),\n})\n","sourceCodeStart":27,"sourceCodeEnd":53,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/ai/tools/search/exa.ts#L27-L53","documentation":"createExaTool's fetch wrapper throws this when the Exa search API responds with a non-OK HTTP status, embedding the status, statusText and raw error body. It surfaces upstream Exa API failures to the agent as tool errors.","triggerScenarios":"Exa API returns 4xx/5xx — invalid or missing API key (401), bad request params (400), rate limiting (429), or server errors (5xx).","commonSituations":"Missing/expired EXA_API_KEY; exceeded rate limits; malformed query parameters; Exa outage.","solutions":["Verify the Exa API key is set and valid","Inspect the error body for the exact API error and fix request parameters","Implement backoff/retry for 429/5xx responses","Check Exa status page for outages"],"exampleFix":"// before\nthrow new Error(`Exa error: ${response.status} ... - {\"error\":\"Invalid API key\"}`)\n// after\n// set correct key before creating tool\nprocess.env.EXA_API_KEY = \"<valid key>\"","handlingStrategy":"retry","validationCode":"if (!process.env.EXA_API_KEY) throw new Error(\"EXA_API_KEY not configured\")","typeGuard":null,"tryCatchPattern":"try { await exaTool.run(args) } catch (e) { if (e.message.startsWith(\"Exa error:\")) { const status = parseInt(e.message); if (status === 429 || status >= 500) await retryWithBackoff(); else surfaceToAgent(e) } }","preventionTips":["Validate EXA_API_KEY at startup","Add exponential backoff for 429/5xx","Keep request payloads within Exa API limits"],"tags":["http","api","network","exa"],"backgroundTag":"upstream-api-http-error","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}