ComposioHQ/composio · error · ValidationError

Failed to validate update params

Error message

Failed to validate update params

What it means

The config passed to mcpConfigs.update() failed validation against MCPUpdateParamsSchema. The SDK validates update payloads client-side and throws ValidationError with the Zod issues attached.

Source

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

   *
   * console.log("Updated server:", fullyUpdatedServer.name);
   * console.log("New tools:", fullyUpdatedServer.allowedTools);
   * ```
   *
   * @throws {ValidationError} When the update parameters are invalid or malformed
   * @throws {Error} When the server ID doesn't exist or update fails
   *
   * @note Only provided fields will be updated. Omitted fields will retain their current values.
   * @note When updating toolkits, the entire toolkit configuration is replaced, not merged.
   */
  async update(
    serverId: string,
    config: MCPUpdateParams,
    requestOptions?: ComposioRequestOptions
  ): Promise<MCPItem> {
    const { data: params, error } = MCPUpdateParamsSchema.safeParse(config);
    if (error) {
      throw new ValidationError('Failed to validate update params', {
        cause: error,
      });
    }

    const toolkits: string[] = [];
    const auth_config_ids: string[] = [];
    const custom_tools: string[] | undefined = params.allowedTools ?? undefined;

    // extract all the toolkits, authconfigs, and allowed tools to separate slugs
    params.toolkits?.forEach(toolkit => {
      if (typeof toolkit === 'string') {
        toolkits.push(toolkit);
      } else if (toolkit.toolkit) {
        toolkits.push(toolkit.toolkit);
      } else if (toolkit.authConfigId) {
        auth_config_ids.push(toolkit.authConfigId);
      }
    });

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Inspect error.cause issues list
  2. Match the payload to MCPUpdateParamsSchema exactly
  3. Type the payload against the exported MCPUpdateParams type

Example fix

// before
await mcp.configs.update(id, { toolkit: ['github'] });
// after
await mcp.configs.update(id, { toolkits: ['github'] });
Defensive patterns

Strategy: type-guard

Validate before calling

import { MCPUpdateParamsSchema } from '@composio/core';
const r = MCPUpdateParamsSchema.safeParse(config);
if (!r.success) throw new Error(JSON.stringify(r.error.issues));
await mcp.configs.update(serverId, config);

Type guard

const isMcpUpdateParams = (c: unknown): c is MCPUpdateParams =>
  MCPUpdateParamsSchema.safeParse(c).success;

Try / catch

try { await mcp.configs.update(id, cfg); } catch (e) { if (e instanceof ValidationError && /update params/.test(e.message)) { rebuildCfg(e.cause); return; } throw e; }

Prevention

When it happens

Trigger: Calling update(serverId, config) with invalid fields — wrong types for toolkits/auth config ids, missing required update fields, or keys not in MCPUpdateParamsSchema.

Common situations: Reusing a creation payload for update when the schemas differ; partial updates sent with undefined required fields; schema drift after upgrading @composio/core.

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