diegosouzapw/OmniRoute · error · Error

Provider validation failed for

Error message

Provider validation failed for ${name}

What it means

Aggregated validation error from validateProviders(): the providers map failed the ProvidersMapSchema Zod check, and the thrown message wraps the provider-map name plus the Zod issue list. It fires at provider-registry load time when a provider definition in providers.ts (or a user-supplied map) violates the schema (bad type, missing required field, invalid enum).

Solutions

  1. Read the wrapped Zod issues to find the exact provider and offending field
  2. Fix the provider definition to satisfy ProviderSchema (fields, enums like serviceKinds, types)
  3. Validate user/custom provider maps with safeParse before passing them in
  4. Keep the schema and providers.ts in sync when adding new provider fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/shared/validation/providerSchema.ts:52 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/d09284b779d3b4e1. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/validation/providerSchema.ts:52

  serviceKinds: z.array(z.enum(SERVICE_KIND_VALUES)).optional(),
  noAuth: z.boolean().optional(),
  anonymousFallback: z.boolean().optional(),
  managedAccount: z.boolean().optional(),
});

export const ProvidersMapSchema = z.record(z.string(), ProviderSchema);

/**
 * Validate a providers map, throwing a descriptive error on failure.
 * @param {Record<string, object>} map - The providers map to validate
 * @param {string} name - Name of the map for error messages
 */
export function validateProviders(map: Record<string, unknown>, name: string): void {
  const result = ProvidersMapSchema.safeParse(map);
  if (!result.success) {
    const issues = result.error.issues.map((i) => `  ${i.path.join(".")}: ${i.message}`).join("\n");
    console.error(`[PROVIDER VALIDATION] ${name} has invalid entries:\n${issues}`);
    throw new Error(`Provider validation failed for ${name}`);
  }
}

View on GitHub (pinned to a179ffed5b)