ComposioHQ/composio · error · ValidationError

Failed to validate list options

Error message

Failed to validate list options

What it means

The options object passed to mcpConfigs.list() failed Zod validation against MCPListParamsSchema before the request was made. Typical causes are wrong pagination field types or unsupported filter keys.

Source

Thrown at ts/packages/core/src/models/MCP.ts:187

   *
   * // Filter by toolkit
   * const githubServers = await composio.experimental.mcp.list({
   *   toolkits: ['github', 'slack']
   * });
   *
   * // Filter by name
   * const namedServers = await composio.experimental.mcp.list({
   *   name: 'personal'
   * });
   * ```
   */
  async list(
    options: MCPListParams,
    requestOptions?: ComposioRequestOptions
  ): Promise<MCPListResponse> {
    const { data: params, error } = MCPListParamsSchema.safeParse(options);
    if (error) {
      throw new ValidationError('Failed to validate list options', {
        cause: error,
      });
    }

    const listParams = {
      page_no: params.page,
      limit: params.limit,
      toolkits: params.toolkits?.length > 0 ? params.toolkits.join(',') : undefined,
      auth_config_ids: params.authConfigs?.length > 0 ? params.authConfigs.join(',') : undefined,
      name: params.name,
    };
    const listResponse = await withCancellation(
      () => this.client.mcp.list(listParams, requestOptions),
      requestOptions?.signal
    );

    const transformedListResponse = transform(listResponse)
      .with(MCPListResponseSchema)

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Check error.cause for the failing field
  2. Coerce pagination values to numbers before calling list()
  3. Pass only documented MCPListParams fields

Example fix

// before
await mcp.configs.list({ page: req.query.page });
// after
await mcp.configs.list({ page: Number(req.query.page ?? 1) });
Defensive patterns

Strategy: validation

Validate before calling

const page = Number(options?.page ?? 1);
if (!Number.isInteger(page) || page < 1) throw new Error('invalid page');
await mcp.configs.list({ page });

Type guard

const isMcpListParams = (o: unknown): o is MCPListParams =>
  MCPListParamsSchema.safeParse(o).success;

Try / catch

try { await mcp.configs.list(opts); } catch (e) { if (e instanceof ValidationError && /list options/.test(e.message)) { opts = { page: 1 }; await mcp.configs.list(opts); return; } throw e; }

Prevention

When it happens

Trigger: Calling list/listResponse with e.g. page as a string, negative page numbers, or unknown properties rejected by MCPListParamsSchema.

Common situations: Passing query-string-derived values (always strings) straight into list(); using an options shape copied from a different SDK version; spreading extra filters the schema strict-rejects.

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