coleam00/Archon · error · InvalidProviderRunConfigError

provider did not accept the model

Error message

provider did not accept the model

What it means

parseProviderRunModel validates a run-owned model string by routing it through the provider's strict parseRunConfig. If the provider accepts the input but the parsed result has no non-blank model, the provider effectively rejected the model, so this throws InvalidProviderRunConfigError for the 'model' field. It catches models a provider silently drops rather than passing an empty model downstream.

Source

Thrown at packages/providers/src/registry.ts:93

  if (!entry) {
    throw new UnknownProviderError(id, [...registry.keys()]);
  }
  return entry;
}

/**
 * Get provider capabilities without instantiating a provider.
 * @throws UnknownProviderError if not registered
 */
export function getProviderCapabilities(id: string): ProviderCapabilities {
  return getRegistration(id).capabilities;
}

/** Validate and normalize a run-owned model through the provider's strict parser. */
export function parseProviderRunModel(id: string, model: string): string {
  const parsed = getRegistration(id).parseRunConfig({ model });
  if (typeof parsed.model !== 'string' || parsed.model.trim().length === 0) {
    throw new InvalidProviderRunConfigError('model', 'provider did not accept the model');
  }
  return parsed.model;
}

/**
 * Get all registered providers.
 */
export function getRegisteredProviders(): ProviderRegistration[] {
  return [...registry.values()];
}

/**
 * Get API-safe provider info (excludes the factory).
 */
export function getProviderInfoList(): ProviderInfo[] {
  return getRegisteredProviders().map(({ id, displayName, capabilities, builtIn }) => ({
    id,
    displayName,

View on GitHub (pinned to 0773b97458)

Solutions

  1. Use a model identifier the provider's parser accepts (check the provider's supported model list/presets)
  2. Strip provider prefixes and pass the bare model ID the parser expects
  3. Log/inspect the raw input — an empty or blank model reaching this function indicates earlier validation is missing

Example fix

// before
const model = parseProviderRunModel('claude', 'anthropic/claude-sonnet-4');
// after
const model = parseProviderRunModel('claude', 'claude-sonnet-4');
Defensive patterns

Strategy: validation

Validate before calling

if (typeof model !== 'string' || model.trim().length === 0) {
  throw new Error('model must be a non-blank string before parseProviderRunModel');
}

Type guard

function isNonBlankString(v: unknown): v is string {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

import { InvalidProviderRunConfigError } from '@archon/providers';
try {
  model = parseProviderRunModel(providerId, rawModel);
} catch (err) {
  if (err instanceof InvalidProviderRunConfigError && err.fieldPath === 'model') {
    console.error(`Provider '${providerId}' rejected model '${rawModel}'; use a supported model`);
  }
  throw err;
}

Prevention

When it happens

Trigger: parseProviderRunModel(id, model) where getRegistration(id).parseRunConfig({ model }) returns an object whose .model is undefined, empty, or whitespace-only — e.g. the provider's parser strips/normalizes an unsupported alias to nothing.

Common situations: Model alias not recognized by the installed provider version; passing a provider-prefixed model ('claude/x') to a parser that expects a bare ID; empty or whitespace model string slipping through earlier validation; model renamed/deprecated upstream.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/f196c554761b9169. Report an issue: GitHub.