{"record":{"id":"14caff20907e9d45","repo":"ComposioHQ/composio","slug":"failed-to-parse-auth-config-update-data","errorCode":null,"errorMessage":"Failed to parse auth config update data","messagePattern":"Failed to parse auth config update data","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/AuthConfigs.ts","lineNumber":250,"sourceCode":"   *     apiKey: 'new-api-key-value'\n   *   }\n   * });\n   *\n   * // Update a default auth config with new scopes\n   * const updatedConfig = await composio.authConfigs.update('auth_abc123', {\n   *   type: 'default',\n   *   scopes: ['read:user', 'repo']\n   * });\n   * ```\n   */\n  async update(\n    nanoid: string,\n    data: AuthConfigUpdateParams,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<AuthConfigUpdateResponse> {\n    const parsedData = AuthConfigUpdateParamsSchema.safeParse(data);\n    if (parsedData.error) {\n      throw new ValidationError('Failed to parse auth config update data', {\n        cause: parsedData.error,\n      });\n    }\n    const updateBody =\n      parsedData.data.type === 'custom'\n        ? {\n            type: 'custom' as const,\n            credentials: parsedData.data.credentials,\n            is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,\n            tool_access_config: {\n              tools_for_connected_account_creation:\n                parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,\n              tools_available_for_execution:\n                parsedData.data.toolAccessConfig?.toolsAvailableForExecution ??\n                parsedData.data.restrictToFollowingTools,\n            },\n          }\n        : {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/AuthConfigs.ts#L232-L268","documentation":"ValidationError from AuthConfigs.update: the data argument failed AuthConfigUpdateParamsSchema before the update body is built. Different update types (e.g. custom) produce different required field sets, and the discriminated union rejects mismatches.","triggerScenarios":"authConfigs.update(nanoid, { type: 'custom', ... }) missing required custom fields; passing fields that belong to a different auth type; updating with a stale shape after the API contract changed.","commonSituations":"Updating legacy auth configs after SDK upgrades; merging partial patches that drop required discriminator fields; automated scripts reusing create payloads for updates.","solutions":["Check error.cause ZodError issues for required/invalid fields","Match all fields required by the type discriminator you're sending","Fetch the current auth config and derive the update payload from it","Use the exported AuthConfigUpdateParams TS type"],"exampleFix":"// before\nauthConfigs.update(id, { type: 'custom', creds: 'token' } as any);\n// after\nauthConfigs.update(id, { type: 'custom', creds: { key: 'API_KEY', value: '...' } });","handlingStrategy":"validation","validationCode":"import { AuthConfigUpdateParamsSchema } from '@composio/core';\nconst check = AuthConfigUpdateParamsSchema.safeParse(data);\nif (!check.success) console.error(check.error.issues);","typeGuard":"const validUpdateData = (d: unknown): boolean =>\n  AuthConfigUpdateParamsSchema.safeParse(d).success;","tryCatchPattern":"try { await authConfigs.update(id, data); } catch (e) { if (e instanceof ValidationError && e.message.includes('auth config update')) fixFromZodIssues(e.cause); }","preventionTips":["Type update payloads with exported schema types","Fetch the current auth config to model the update"],"tags":["validation","zod","auth-config","sdk"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}