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
- 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
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
- Type options as CreateAuthConfigParams
- Omit options for managed auth instead of hand-building objects
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse auth config update data
- Failed to parse manage connections config
- Failed to parse connected account list query
- experimental_subAgent() schema must be a Zod schema or JSON
- Invalid arguments for local tool ${resolution.finalSlug}: ${
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/d1a7c766a8271e65.
Report an issue: GitHub.