{"record":{"id":"ab15147f1358800a","repo":"ComposioHQ/composio","slug":"toolkit-fetch-error","errorCode":"TOOLKIT_FETCH_ERROR","errorMessage":"Failed to fetch toolkit","messagePattern":"Failed to fetch toolkit","errorType":"error_code","errorClass":"ComposioToolkitFetchError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/errors/ToolkitErrors.ts","lineNumber":30,"sourceCode":"    super(message, {\n      ...options,\n      code: 'TOOLKIT_NOT_FOUND',\n      possibleFixes: options.possibleFixes || [\n        'Ensure the toolkit is correctly configured and the slug is valid',\n      ],\n    });\n    this.name = 'ComposioToolkitNotFoundError';\n  }\n}\n\nexport class ComposioToolkitFetchError extends ComposioError {\n  constructor(\n    message: string = 'Failed to fetch toolkit',\n    options: Omit<ComposioErrorOptions, 'code' | 'statusCode'> = {}\n  ) {\n    super(message, {\n      ...options,\n      code: 'TOOLKIT_FETCH_ERROR',\n      possibleFixes: options.possibleFixes || [\n        'Ensure the toolkit slug is valid',\n        'Ensure you are using the correct API key',\n        'Ensure you are using the correct API endpoint / Base URL and it is working',\n      ],\n    });\n    this.name = 'ComposioToolkitFetchError';\n  }\n}\n","sourceCodeStart":12,"sourceCodeEnd":40,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/errors/ToolkitErrors.ts#L12-L40","documentation":"ComposioToolkitFetchError (code TOOLKIT_FETCH_ERROR): thrown when the HTTP request to fetch a toolkit fails (network error, auth failure, or server error) — distinct from TOOLKIT_NOT_FOUND which is a 404-style miss. Suggested fixes include validating the slug, API key, and base URL.","triggerScenarios":"composio.toolkits.get(slug) when the API key is invalid/expired, the base URL points to a wrong/unreachable endpoint, network is down, or the backend returns 5xx.","commonSituations":"Wrong apiKey or env var; custom baseUrl misconfigured (e.g. pointing at staging when key is prod); proxies/firewalls blocking api URLs; backend outages.","solutions":["Verify the API key is valid for the endpoint you're using","Check baseUrl configuration matches the key's environment","Retry with backoff — transient 5xx/network failures often resolve","Catch by code TOOLKIT_FETCH_ERROR and distinguish from TOOLKIT_NOT_FOUND"],"exampleFix":"// before\nnew Composio({ apiKey: process.env.COMPOSIO_API_KEY }) // unset var -> fetch fails\n// after\nconst apiKey = process.env.COMPOSIO_API_KEY;\nif (!apiKey) throw new Error('COMPOSIO_API_KEY missing');\nnew Composio({ apiKey });","handlingStrategy":"retry","validationCode":"if (!process.env.COMPOSIO_API_KEY) throw new Error('missing key');","typeGuard":"import { ComposioToolkitFetchError } from '@composio/core/errors';\nconst isFetchError = (e: unknown): boolean => e instanceof ComposioToolkitFetchError;","tryCatchPattern":"try { ... } catch (e) { if (e instanceof ComposioToolkitFetchError) await retryWithBackoff(fn, 3); else throw e; }","preventionTips":["Validate API key and baseUrl at startup","Retry transient 5xx/network failures with backoff"],"tags":["network","toolkit","api","sdk"],"backgroundTag":"api-fetch-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}