coleam00/Archon · error · Error

Alias '${name}' has invalid model — must be a non-empty stri

Error message

Alias '${name}' has invalid model — must be a non-empty string.

What it means

`assertValidEntry` enforces that each alias entry's `model` field is a non-empty string. The library throws this during profile construction because an alias without a concrete model identifier cannot produce a usable model binding.

Source

Thrown at packages/workflows/src/model-validation.ts:104

      `Alias name '${name}' is reserved (small/medium/large are tier keywords). Use a different name.`
    );
  }
}

function assertCustomAliasPrefix(name: string): void {
  if (!name.startsWith('@')) {
    throw new Error(
      `Alias name '${name}' must start with '@' (e.g. '@${name}'). Reserved tier names (small/medium/large) do not need '@'.`
    );
  }
}

function assertValidEntry(name: string, entry: RawAliasEntry): void {
  if (typeof entry.provider !== 'string' || entry.provider.length === 0) {
    throw new Error(`Alias '${name}' has invalid provider — must be a non-empty string.`);
  }
  if (typeof entry.model !== 'string' || entry.model.length === 0) {
    throw new Error(`Alias '${name}' has invalid model — must be a non-empty string.`);
  }
}

function assertValidPersistedPreset(name: string, entry: ModelAliasPreset): void {
  if (entry.effort !== undefined && !isEffortValidForProvider(entry.provider, entry.effort)) {
    throw new Error(`Model binding '${name}' has an invalid effort.`);
  }
}

export type RunModelPresetValidationIssue =
  | { kind: 'unknown-provider'; provider: string; field: 'provider' }
  | { kind: 'invalid-model'; provider: string; model: string; reason: string; field: 'model' }
  | { kind: 'unsupported-effort'; provider: string; effort: string; field: 'effort' }
  | {
      kind: 'invalid-effort';
      provider: string;
      effort: string;
      valid: readonly string[];

View on GitHub (pinned to 0773b97458)

Solutions

  1. Set `model` to a non-empty model identifier string for the given provider
  2. Check YAML indentation so `model:` is a direct child of the alias entry
  3. Verify the model id is valid for the provider (run resolution once the shape is fixed)

Example fix

# before
aliases:
  '@fast':
    provider: openai
    model:
# after
aliases:
  '@fast':
    provider: openai
    model: gpt-4o-mini
Defensive patterns

Strategy: validation

Validate before calling

// Shape-check alias entries before profile build.
function hasValidModel(entry: unknown): entry is { provider: string; model: string } {
  return typeof entry === 'object' && entry !== null &&
    typeof (entry as any).model === 'string' && (entry as any).model.length > 0;
}

Type guard

function hasNonEmptyString<K extends string>(obj: unknown, key: K): obj is Record<K, string> {
  return typeof obj === 'object' && obj !== null &&
    typeof (obj as Record<string, unknown>)[key] === 'string' &&
    ((obj as Record<string, unknown>)[key] as string).length > 0;
}

Try / catch

try {
  const profile = buildAiProfile(rawConfig);
} catch (err) {
  if (err instanceof Error && err.message.includes('invalid model')) {
    const alias = err.message.match(/Alias '([^']+)'/)?.[1];
    throw new Error(`Alias ${alias} in config needs a non-empty model: value`, { cause: err });
  }
  throw err;
}

Prevention

When it happens

Trigger: Defining an alias where `model` is missing, an empty string, or a non-string value — evaluated via `buildAiProfile` while building the resolved AI profile from layered config.

Common situations: YAML indentation errors leaving `model:` empty, typos like `modle:`, or moving the model id into an `effort:` or nested key by mistake.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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