ComposioHQ/composio · error · ValidationError

Failed to parse toolkit list query

Error message

Failed to parse toolkit list query

What it means

getToolkits() validates its query argument with ToolkitsListParamsSchema before fetching. If the query object contains invalid values (unknown categories, wrong-typed flags like managedBy), a ValidationError wrapping the Zod issues is thrown. This is a fail-fast check on caller input.

Source

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

  /**
   * Retrieves a list of toolkits based on the provided query parameters.
   *
   * This method fetches toolkits from the Composio API and transforms the response
   * from snake_case to camelCase format for consistency with JavaScript/TypeScript conventions.
   *
   * @param {ToolkitListParams} query - The query parameters to filter toolkits
   * @returns {Promise<ToolKitListResponse>} The transformed list of toolkits
   *
   * @private
   */
  private async getToolkits(
    query: ToolkitListParams,
    requestOptions?: ComposioRequestOptions
  ): Promise<ToolKitListResponse> {
    try {
      const parsedQuery = ToolkitsListParamsSchema.safeParse(query);
      if (!parsedQuery.success) {
        throw new ValidationError('Failed to parse toolkit list query', {
          cause: parsedQuery.error,
        });
      }
      const listParams = {
        category: parsedQuery.data.category,
        managed_by: parsedQuery.data.managedBy,
        sort_by: parsedQuery.data.sortBy,
        cursor: parsedQuery.data.cursor,
        limit: parsedQuery.data.limit,
      };
      const result = await withCancellation(
        () => this.client.toolkits.list(listParams, requestOptions),
        requestOptions?.signal
      );

      return transformToolkitListResponse(result);
    } catch (error) {
      if (error instanceof ComposioRequestCancelledError) {

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Check error.cause (ZodError) for the exact failing field and allowed values
  2. Correct the category/managedBy values to the current allowed enums
  3. Update @composio/core in case the allowed category list expanded

Example fix

// before
await composio.toolkits.get({ category: 'DEFAULt' } as any);
// after
await composio.toolkits.get({ category: 'default' });
Defensive patterns

Strategy: validation

Validate before calling

const r = ToolkitsListParamsSchema.safeParse(query);
if (!r.success) throw new Error(r.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; '));
return composio.toolkits.get(r.data);

Type guard

const isToolkitQuery = (q: unknown): q is { category?: string; managedBy?: string } =>
  typeof q === 'object' && q !== null &&
  Object.values(q).every(v => v === undefined || typeof v === 'string');

Try / catch

try { await composio.toolkits.get(query); } catch (e) { if (e instanceof ValidationError) { for (const i of e.cause?.issues ?? []) console.error(i.path, i.message); } throw e; }

Prevention

When it happens

Trigger: Calling composio.toolkits.get({ ... }) with a category string not in the allowed set, managedBy of the wrong type, or other schema-violating query fields.

Common situations: Passing a typo'd or deprecated category (e.g. 'CRM ' or an old name after the category enum changed), or copying query params from an older SDK version.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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