coleam00/Archon · error · InvalidProviderRunConfigError

expected ${expected}

Error message

expected ${expected}

What it means

invalidRunConfigValue is the shared helper provider parsers use to throw InvalidProviderRunConfigError for a field that exists but has the wrong shape or value; the message is always 'expected <requirement>' (e.g. 'a non-blank string'). It is the value-level counterpart to assertKnownRunConfigKeys, which handles unknown keys.

Source

Thrown at packages/providers/src/shared/run-config.ts:14

import { InvalidProviderRunConfigError } from '../errors';

export function assertKnownRunConfigKeys(
  raw: Record<string, unknown>,
  allowed: readonly string[]
): void {
  const unknown = Object.keys(raw).find(key => !allowed.includes(key));
  if (unknown !== undefined) {
    throw new InvalidProviderRunConfigError(unknown, 'unknown provider setting');
  }
}

export function invalidRunConfigValue(fieldPath: string, expected: string): never {
  throw new InvalidProviderRunConfigError(fieldPath, `expected ${expected}`);
}

export function normalizeRunConfigString(value: unknown, fieldPath: string): string | undefined {
  if (value === undefined) return undefined;
  if (typeof value !== 'string' || value.trim().length === 0) {
    invalidRunConfigValue(fieldPath, 'a non-blank string');
  }
  return value.trim();
}

export function isConfigRecord(value: unknown): value is Record<string, unknown> {
  return value !== null && typeof value === 'object' && !Array.isArray(value);
}

View on GitHub (pinned to 0773b97458)

Solutions

  1. Read the 'expected ...' phrase in the error and fix the field's type/value to match
  2. Trim or supply a non-blank string where blank values occur (e.g. from empty env vars)
  3. Coerce or correct types at the config source (quote/unquote in YAML, use proper JSON types)
  4. Check the provider parser's allowed values for enum-like fields

Example fix

// before
parseCodexRunConfig({ model: process.env.CODEX_MODEL ?? '' });
// after
const model = process.env.CODEX_MODEL?.trim();
if (!model) throw new Error('CODEX_MODEL must be set');
parseCodexRunConfig({ model });
Defensive patterns

Strategy: validation

Validate before calling

function assertNonBlankString(v: unknown, field: string): asserts v is string {
  if (typeof v !== 'string' || v.trim().length === 0) {
    throw new Error(`${field} must be a non-blank string`);
  }
}

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 {
  cfg = parseRunConfig(raw);
} catch (err) {
  if (err instanceof InvalidProviderRunConfigError) {
    console.error(`Field '${err.fieldPath}': ${err.message} — fix the value's type/shape`);
  }
  throw err;
}

Prevention

When it happens

Trigger: Any parseXxxRunConfig call where a known key holds an invalid value: a blank/non-string model, wrong type for a flag, malformed enum value — each parser calls invalidRunConfigValue(fieldPath, expected) with the specific expectation.

Common situations: YAML/JSON quoting mistakes turning numbers into strings or vice versa; empty-string settings from env interpolation; passing boolean flags as strings; supplying an out-of-range or unrecognized enum value.

Related errors


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