ComposioHQ/composio · error · ComposioToolkitFetchError

Couldn't fetch Toolkit with slug: ${slug}

Error message

Couldn't fetch Toolkit with slug: ${slug}

What it means

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.

Source

Thrown at ts/packages/core/src/models/Toolkits.ts:121

    try {
      const result = await withCancellation(
        () => this.client.toolkits.retrieve(slug, undefined, requestOptions),
        requestOptions?.signal
      );
      return transformToolkitRetrieveResponse(result);
    } catch (error) {
      if (error instanceof ComposioRequestCancelledError) {
        throw error;
      }
      if (error instanceof APIError && (error.status === 404 || error.status === 400)) {
        throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
          meta: {
            slug,
          },
          cause: error,
        });
      }
      throw new ComposioToolkitFetchError(`Couldn't fetch Toolkit with slug: ${slug}`, {
        meta: {
          slug,
        },
        cause: error,
      });
    }
  }

  /**
   * Retrieves a specific toolkit by its slug identifier.
   *
   * @param {string} slug - The unique slug identifier of the toolkit to retrieve
   * @returns {Promise<ToolkitRetrieveResponse>} The toolkit object with detailed information
   * @throws {ComposioToolNotFoundError} If no toolkit with the given slug exists
   *
   * @example
   * ```typescript
   * // Get a specific toolkit

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Verify the slug exists: list toolkits (toolkits.list()) or check the Composio toolkit directory, then correct the slug passed in config/tool calls.
  2. If the slug is correct, check network connectivity and the Composio API base URL / API key configuration.
  3. If the toolkit is new or renamed, upgrade @composio/core to the latest version so generated metadata matches available toolkits.
  4. Catch ComposioToolkitFetchError and inspect error.cause to distinguish a 404 (wrong slug) from transport failures.

Example fix

// before
const toolkit = await composio.toolkits.get({ toolkit: 'githubh' });

// after
const all = await composio.toolkits.list();
const slug = all.items.find(t => t.name.toLowerCase().includes('github'))?.slug;
if (!slug) throw new Error('Toolkit not found');
const toolkit = await composio.toolkits.get({ toolkit: slug });
Defensive patterns

Strategy: try-catch

Validate before calling

const slugs = (await composio.toolkits.list()).items.map(t => t.slug);
if (!slugs.includes(mySlug)) throw new Error(`Unknown toolkit slug: ${mySlug}`);

Type guard

const isToolkitFetchError = (e: unknown): e is ComposioToolkitFetchError =>
  e instanceof ComposioToolkitFetchError;

Try / catch

try {
  const tk = await composio.toolkits.get({ toolkit: slug });
} catch (e) {
  if (e instanceof ComposioToolkitFetchError && (e.cause as any)?.status === 404) {
    // wrong slug
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/0ac457511dd457b3. Report an issue: GitHub.