ComposioHQ/composio · error · ComposioProviderNotDefinedError

Provider not passed into Tools instance

Error message

Provider not passed into Tools instance

What it means

ComposioProviderNotDefinedError thrown by the Tools constructor when config.provider is absent. Tools needs an LLM provider to format tool schemas correctly, so omitting it is treated as a programming error.

Source

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

  };
  /**
   * Tracks tool slugs we've already warned about to avoid spamming the log when
   * the same file-input tool is executed repeatedly while auto-upload is off.
   * Scoped per-instance so a fresh `Composio` starts with a clean slate.
   */
  private readonly warnedAutoUploadDisabledForTool = new Set<string>();

  /**
   * Lazily-built sibling client with retries disabled; see `clientWithoutRetries`.
   */
  private clientWithoutRetriesCache?: ComposioClient;

  constructor(client: ComposioClient, config?: ComposioConfig<TProvider>) {
    if (!client) {
      throw new Error('ComposioClient is required');
    }
    if (!config?.provider) {
      throw new ComposioProviderNotDefinedError('Provider not passed into Tools instance');
    }

    this.client = client;
    this.provider = config.provider;
    this.autoUploadDownloadFiles = config?.dangerouslyAllowAutoUploadDownloadFiles === true;
    this.toolkitVersions = config?.toolkitVersions ?? CONFIG_DEFAULTS.toolkitVersions;
    this.fileUploadPathOptions = {
      sensitiveFileUploadProtection: config?.sensitiveFileUploadProtection,
      fileUploadPathDenySegments: config?.fileUploadPathDenySegments,
      // The allowlist is only enforced during automatic upload (see
      // FileToolModifier). Manual `composio.files.upload()` calls don't see it.
      fileUploadAllowlist: this.autoUploadDownloadFiles
        ? resolveEffectiveUploadAllowlist(config?.fileUploadDirs)
        : undefined,
      fileDownloadDir: config?.fileDownloadDir,
    };
    // Bind the execute method to ensure correct 'this' context
    this.execute = this.execute.bind(this);

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Pass provider when creating the client: new Composio({ apiKey, provider: 'openai' }).
  2. Or set it per-call if the API supports it; otherwise construct Tools with { provider: 'your-provider' }.
  3. Check migration notes if upgrading from an older @composio/core where provider was optional or positional.

Example fix

// before
const tools = new Tools(client);

// after
const tools = new Tools(client, { provider: 'openai' });
// or typically:
const composio = new Composio({ apiKey: key, provider: 'openai' });
const tools = composio.tools;
Defensive patterns

Strategy: validation

Validate before calling

if (!config?.provider) throw new Error('provider is required');
new Tools(client, { provider: config.provider });

Type guard

const hasProvider = (c?: ComposioConfig<unknown>): boolean => !!c?.provider;

Prevention

When it happens

Trigger: new Tools(client) or new Tools(client, {}) — no provider in config; or creating Composio without a provider and then accessing a Tools path that requires it.

Common situations: Initializing Composio without provider (valid for some flows) but then calling provider-dependent tool APIs; typos in the config object; version upgrades where provider moved into the config object.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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