{"record":{"id":"d1a7c766a8271e65","repo":"ComposioHQ/composio","slug":"failed-to-parse-auth-config-create-options","errorCode":null,"errorMessage":"Failed to parse auth config create options","messagePattern":"Failed to parse auth config create options","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/AuthConfigs.ts","lineNumber":134,"sourceCode":"   * const authConfig = await authConfigs.create('my-toolkit', {\n   *   type: AuthConfigTypes.CUSTOM,\n   *   name: 'My Custom Auth Config',\n   *   authScheme: AuthSchemeTypes.API_KEY,\n   *   credentials: {\n   *     apiKey: '1234567890',\n   *   },\n   * });\n   *\n   * @link https://docs.composio.dev/reference/auth-configs/create-auth-config\n   */\n  async create(\n    toolkit: string,\n    options: CreateAuthConfigParams = { type: 'use_composio_managed_auth' },\n    requestOptions?: ComposioRequestOptions\n  ): Promise<CreateAuthConfigResponse> {\n    const parsedOptions = CreateAuthConfigParamsSchema.safeParse(options);\n    if (parsedOptions.error) {\n      throw new ValidationError('Failed to parse auth config create options', {\n        cause: parsedOptions.error,\n      });\n    }\n    const createBody = {\n      toolkit: {\n        slug: toolkit,\n      },\n      auth_config:\n        parsedOptions.data.type === 'use_custom_auth'\n          ? {\n              type: parsedOptions.data.type,\n              name: parsedOptions.data.name,\n              authScheme: parsedOptions.data.authScheme,\n              credentials: parsedOptions.data.credentials,\n              is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,\n              proxy_config: parsedOptions.data.proxyConfig\n                ? {\n                    proxy_url: parsedOptions.data.proxyConfig.proxyUrl,","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/AuthConfigs.ts#L116-L152","documentation":"ValidationError from AuthConfigs.create: the options argument failed CreateAuthConfigParamsSchema. Because the default is use_composio_managed_auth, this only fires when you explicitly pass options with an invalid type (unknown auth type string) or fields that don't match the discriminated union for that auth mode.","triggerScenarios":"authConfigs.create('toolkit', { type: 'random_type' }); passing OAuth fields on a no-auth type; missing required fields for custom auth (e.g. creds without proper structure); typos in the discriminated type key.","commonSituations":"Building auth configs programmatically from unvalidated user input; schema drift after SDK upgrade added/changed auth types; copy-pasting examples for a different auth mode.","solutions":["Read error.cause (ZodError) issues for the failing fields","Use a valid type from CreateAuthConfigParamsSchema (e.g. use_composio_managed_auth, no_auth, oauth2/custom variants per current SDK)","Omit options entirely to use Composio-managed auth","Type options as CreateAuthConfigParams so TS catches errors pre-runtime"],"exampleFix":"// before\nauthConfigs.create('github', { type: 'oath2' } as any);\n// after\nauthConfigs.create('github', { type: 'use_composio_managed_auth' });","handlingStrategy":"validation","validationCode":"import { CreateAuthConfigParamsSchema } from '@composio/core';\nconst check = CreateAuthConfigParamsSchema.safeParse(options);\nif (!check.success) console.error(check.error.issues);","typeGuard":"const validCreateOptions = (o: unknown): boolean =>\n  CreateAuthConfigParamsSchema.safeParse(o).success;","tryCatchPattern":"try { await authConfigs.create(tk, options); } catch (e) { if (e instanceof ValidationError && e.message.includes('auth config create')) fixFromZodIssues(e.cause); }","preventionTips":["Type options as CreateAuthConfigParams","Omit options for managed auth instead of hand-building objects"],"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"}