{"record":{"id":"66f2d1715ae9e880","repo":"ComposioHQ/composio","slug":"composioclient-is-required","errorCode":null,"errorMessage":"ComposioClient is required","messagePattern":"ComposioClient is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/Tools.ts","lineNumber":128,"sourceCode":"    fileUploadPathDenySegments?: string[];\n    fileUploadAllowlist?: string[];\n    fileDownloadDir?: string;\n  };\n  /**\n   * Tracks tool slugs we've already warned about to avoid spamming the log when\n   * the same file-input tool is executed repeatedly while auto-upload is off.\n   * Scoped per-instance so a fresh `Composio` starts with a clean slate.\n   */\n  private readonly warnedAutoUploadDisabledForTool = new Set<string>();\n\n  /**\n   * Lazily-built sibling client with retries disabled; see `clientWithoutRetries`.\n   */\n  private clientWithoutRetriesCache?: ComposioClient;\n\n  constructor(client: ComposioClient, config?: ComposioConfig<TProvider>) {\n    if (!client) {\n      throw new Error('ComposioClient is required');\n    }\n    if (!config?.provider) {\n      throw new ComposioProviderNotDefinedError('Provider not passed into Tools instance');\n    }\n\n    this.client = client;\n    this.provider = config.provider;\n    this.autoUploadDownloadFiles = config?.dangerouslyAllowAutoUploadDownloadFiles === true;\n    this.toolkitVersions = config?.toolkitVersions ?? CONFIG_DEFAULTS.toolkitVersions;\n    this.fileUploadPathOptions = {\n      sensitiveFileUploadProtection: config?.sensitiveFileUploadProtection,\n      fileUploadPathDenySegments: config?.fileUploadPathDenySegments,\n      // The allowlist is only enforced during automatic upload (see\n      // FileToolModifier). Manual `composio.files.upload()` calls don't see it.\n      fileUploadAllowlist: this.autoUploadDownloadFiles\n        ? resolveEffectiveUploadAllowlist(config?.fileUploadDirs)\n        : undefined,\n      fileDownloadDir: config?.fileDownloadDir,","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Tools.ts#L110-L146","documentation":"Plain Error thrown by the Tools constructor when called without a ComposioClient instance. The Tools model is normally created for you by Composio, so hitting this usually means Tools was instantiated manually or a falsy client was passed in tests.","triggerScenarios":"new Tools(undefined as any, { provider }) — manually constructing Tools without a client, or passing a client variable that is undefined due to failed initialization.","commonSituations":"Unit tests constructing Tools directly; refactoring that loses the client reference; calling new Composio(...) incorrectly so the returned client is undefined.","solutions":["Use composio.tools (the instance property) instead of constructing Tools manually.","If constructing manually, pass a valid ComposioClient: const tools = new Tools(composio, { provider }).","In tests, provide a mock client object implementing the ComposioClient surface used by Tools."],"exampleFix":"// before\nconst tools = new Tools(undefined, { provider: 'openai' });\n\n// after\nconst composio = new Composio({ apiKey: process.env.COMPOSIO_API_KEY!, provider: 'openai' });\nconst tools = composio.tools;","handlingStrategy":"validation","validationCode":"if (!client) throw new TypeError('client must be a ComposioClient');\nconst tools = new Tools(client, { provider });","typeGuard":"const isComposioClient = (c: unknown): c is ComposioClient =>\n  !!c && typeof c === 'object' && 'tools' in c;","tryCatchPattern":null,"preventionTips":["Prefer composio.tools over manual construction.","Mock ComposioClient in unit tests rather than passing undefined."],"tags":["constructor","client","misuse","typescript"],"backgroundTag":"missing-required-argument","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}