{"record":{"id":"0ac457511dd457b3","repo":"ComposioHQ/composio","slug":"couldn-t-fetch-toolkit-with-slug-slug","errorCode":null,"errorMessage":"Couldn't fetch Toolkit with slug: ${slug}","messagePattern":"Couldn't fetch Toolkit with slug: (.+?)","errorType":"exception","errorClass":"ComposioToolkitFetchError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/Toolkits.ts","lineNumber":121,"sourceCode":"    try {\n      const result = await withCancellation(\n        () => this.client.toolkits.retrieve(slug, undefined, requestOptions),\n        requestOptions?.signal\n      );\n      return transformToolkitRetrieveResponse(result);\n    } catch (error) {\n      if (error instanceof ComposioRequestCancelledError) {\n        throw error;\n      }\n      if (error instanceof APIError && (error.status === 404 || error.status === 400)) {\n        throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {\n          meta: {\n            slug,\n          },\n          cause: error,\n        });\n      }\n      throw new ComposioToolkitFetchError(`Couldn't fetch Toolkit with slug: ${slug}`, {\n        meta: {\n          slug,\n        },\n        cause: error,\n      });\n    }\n  }\n\n  /**\n   * Retrieves a specific toolkit by its slug identifier.\n   *\n   * @param {string} slug - The unique slug identifier of the toolkit to retrieve\n   * @returns {Promise<ToolkitRetrieveResponse>} The toolkit object with detailed information\n   * @throws {ComposioToolNotFoundError} If no toolkit with the given slug exists\n   *\n   * @example\n   * ```typescript\n   * // Get a specific toolkit","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Toolkits.ts#L103-L139","documentation":"Thrown by Toolkits.getToolkitBySlug when the backend request for a toolkit by its slug fails (network error, API error, or unknown slug after retry exhaustion). The original error is attached as `cause` and the slug is included in `meta`. It wraps any failure of the underlying getToolkit API call, including the case where no toolkit exists for the given slug.","triggerScenarios":"Calling toolkits.get({ toolkit: 'nonexistent-slug' }) or any API that internally resolves a toolkit by slug (e.g. Tools.execute, getAuthConfigCreationFields) with a typo'd, renamed, or not-yet-published toolkit slug; also transient network/API failures during the fetch.","commonSituations":"Slug typos or casing mistakes, using a toolkit available only in a different region/environment, referencing a toolkit that was renamed or removed by the provider, or network/backend outages causing the GET /toolkits/{slug} request to fail.","solutions":["Verify the slug exists: list toolkits (toolkits.list()) or check the Composio toolkit directory, then correct the slug passed in config/tool calls.","If the slug is correct, check network connectivity and the Composio API base URL / API key configuration.","If the toolkit is new or renamed, upgrade @composio/core to the latest version so generated metadata matches available toolkits.","Catch ComposioToolkitFetchError and inspect error.cause to distinguish a 404 (wrong slug) from transport failures."],"exampleFix":"// before\nconst toolkit = await composio.toolkits.get({ toolkit: 'githubh' });\n\n// after\nconst all = await composio.toolkits.list();\nconst slug = all.items.find(t => t.name.toLowerCase().includes('github'))?.slug;\nif (!slug) throw new Error('Toolkit not found');\nconst toolkit = await composio.toolkits.get({ toolkit: slug });","handlingStrategy":"try-catch","validationCode":"const slugs = (await composio.toolkits.list()).items.map(t => t.slug);\nif (!slugs.includes(mySlug)) throw new Error(`Unknown toolkit slug: ${mySlug}`);","typeGuard":"const isToolkitFetchError = (e: unknown): e is ComposioToolkitFetchError =>\n  e instanceof ComposioToolkitFetchError;","tryCatchPattern":"try {\n  const tk = await composio.toolkits.get({ toolkit: slug });\n} catch (e) {\n  if (e instanceof ComposioToolkitFetchError && (e.cause as any)?.status === 404) {\n    // wrong slug\n  } else { throw e; }\n}","preventionTips":["Validate slugs against toolkits.list() when they come from user input.","Keep @composio/core updated so slug metadata matches the backend.","Centralize slug constants in one module to avoid typos."],"tags":["toolkit","slug","fetch","api","typescript"],"backgroundTag":"resource-not-found","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}