ComposioHQ/composio · error · ValidationError

Failed to parse auth config create options

Error message

Failed to parse auth config create options

What it means

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.

Source

Thrown at ts/packages/core/src/models/AuthConfigs.ts:134

   * const authConfig = await authConfigs.create('my-toolkit', {
   *   type: AuthConfigTypes.CUSTOM,
   *   name: 'My Custom Auth Config',
   *   authScheme: AuthSchemeTypes.API_KEY,
   *   credentials: {
   *     apiKey: '1234567890',
   *   },
   * });
   *
   * @link https://docs.composio.dev/reference/auth-configs/create-auth-config
   */
  async create(
    toolkit: string,
    options: CreateAuthConfigParams = { type: 'use_composio_managed_auth' },
    requestOptions?: ComposioRequestOptions
  ): Promise<CreateAuthConfigResponse> {
    const parsedOptions = CreateAuthConfigParamsSchema.safeParse(options);
    if (parsedOptions.error) {
      throw new ValidationError('Failed to parse auth config create options', {
        cause: parsedOptions.error,
      });
    }
    const createBody = {
      toolkit: {
        slug: toolkit,
      },
      auth_config:
        parsedOptions.data.type === 'use_custom_auth'
          ? {
              type: parsedOptions.data.type,
              name: parsedOptions.data.name,
              authScheme: parsedOptions.data.authScheme,
              credentials: parsedOptions.data.credentials,
              is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
              proxy_config: parsedOptions.data.proxyConfig
                ? {
                    proxy_url: parsedOptions.data.proxyConfig.proxyUrl,

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Read error.cause (ZodError) issues for the failing fields
  2. Use a valid type from CreateAuthConfigParamsSchema (e.g. use_composio_managed_auth, no_auth, oauth2/custom variants per current SDK)
  3. Omit options entirely to use Composio-managed auth
  4. Type options as CreateAuthConfigParams so TS catches errors pre-runtime

Example fix

// before
authConfigs.create('github', { type: 'oath2' } as any);
// after
authConfigs.create('github', { type: 'use_composio_managed_auth' });
Defensive patterns

Strategy: validation

Validate before calling

import { CreateAuthConfigParamsSchema } from '@composio/core';
const check = CreateAuthConfigParamsSchema.safeParse(options);
if (!check.success) console.error(check.error.issues);

Type guard

const validCreateOptions = (o: unknown): boolean =>
  CreateAuthConfigParamsSchema.safeParse(o).success;

Try / catch

try { await authConfigs.create(tk, options); } catch (e) { if (e instanceof ValidationError && e.message.includes('auth config create')) fixFromZodIssues(e.cause); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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