ComposioHQ/composio · error · ComposioToolNotFoundError

Unable to retrieve tool with slug ${slug}

Error message

Unable to retrieve tool with slug ${slug}

What it means

ComposioToolNotFoundError thrown by getRawComposioToolBySlug when the backend request to fetch a single tool by slug fails for any non-cancellation reason. The original network/HTTP error is preserved as cause; the message includes the requested slug.

Source

Thrown at ts/packages/core/src/models/Tools.ts:713

    options?: ToolRetrievalOptions,
    requestOptions?: ComposioRequestOptions
  ): Promise<Tool> {
    let tool: ToolRetrieveResponse;
    try {
      // Build API call parameters based on version source
      const retrieveParams = options?.version
        ? { version: options.version } // Explicit version → use 'version' param
        : { toolkit_versions: this.toolkitVersions }; // SDK config → use 'toolkit_versions' param

      tool = await withCancellation(
        () => this.client.tools.retrieve(slug, retrieveParams, requestOptions),
        requestOptions?.signal
      );
    } catch (error) {
      if (error instanceof ComposioRequestCancelledError) {
        throw error;
      }
      throw new ComposioToolNotFoundError(`Unable to retrieve tool with slug ${slug}`, {
        cause: error,
      });
    }

    // change the case of the tool to camel case and apply default modifiers
    let [modifiedTool] = await this.applyDefaultSchemaModifiers([this.transformToolCases(tool)]);
    // apply local modifiers if they are provided
    if (options?.modifySchema) {
      const modifier = options.modifySchema;
      if (typeof modifier === 'function') {
        modifiedTool = await modifier({
          toolSlug: slug,
          toolkitSlug: modifiedTool.toolkit?.slug ?? 'unknown',
          schema: modifiedTool,
        });
      } else {
        throw new ComposioInvalidModifierError('Invalid schema modifier. Not a function.');
      }

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Verify the slug by listing tools: composio.tools.get({ toolkits: [...] }) or search
  2. Check e.cause for the real underlying HTTP/network error
  3. Confirm API key and that the tool exists in your workspace/environment

Example fix

// before
const tool = await composio.tools.get({ toolSlug: 'github_star' });
// after
const list = await composio.tools.get({ search: 'star' }); // confirm actual slug
const tool = await composio.tools.get({ toolSlug: list.items[0].slug });
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await composio.tools.get({ search: slug }).then(r => r.items.some(t => t.slug === slug));

Type guard

const isToolNotFound = (e: unknown): e is ComposioToolNotFoundError => e instanceof ComposioToolNotFoundError;

Try / catch

try { const tool = await composio.tools.get({ toolSlug: slug }); } catch (e) { if (isToolNotFound(e)) { console.error(e.cause); /* fallback slug list */ } throw e; }

Prevention

When it happens

Trigger: Calling composio.tools.get({ toolSlug }) / getRawToolWithAuthConfigs with a slug that doesn't exist, a typo'd or renamed slug, or when the underlying API call fails (auth, network, 404).

Common situations: Slug renamed upstream (e.g. versioned tool slugs like tool_v2), typos in slugs, missing/invalid API key causing the fetch to fail, tool not enabled for the workspace.

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/7cf29fade95c6cd5. Report an issue: GitHub.