coleam00/Archon · error

Gitea API error

Error message

Gitea API error: ${String(response.status)}

What it means

normalizeRunOverridePreset normalizes a run-level model override preset through normalizeStrictRunModelPreset, which enforces the strict preset shape (valid provider, model string, allowed fields). When that validator throws RunModelPresetValidationError, it is re-thrown as a plain Error that names the override target and embeds the validator's message, so the developer knows which override entry is malformed.

Solutions

  1. Read the embedded error.message after the target name — it states exactly which field is invalid.
  2. Provide the full strict preset shape: a valid provider slug plus a model string, e.g. { provider: 'anthropic', model: 'claude-sonnet-4' }.
  3. Use the 'provider/model' shorthand spec instead of a raw object if you only know provider and model.
  4. Validate the preset with normalizeStrictRunModelPreset in a try/catch before passing it if constructing programmatically.

Example fix

// before
{ reasoning: { provider: 'openai' } }            // missing model
// after
{ reasoning: { provider: 'openai', model: 'gpt-4o' } }
Defensive patterns

Strategy: validation

Validate before calling

import { normalizeStrictRunModelPreset } from '@archon/workflows/model-validation';
try { normalizeStrictRunModelPreset(preset); } catch (e) { console.error('invalid preset', e); }

Type guard

function isValidPreset(p: unknown): p is { provider: string; model: string } {
  return typeof p === 'object' && p !== null &&
    'provider' in p && typeof (p as any).provider === 'string' &&
    'model' in p && typeof (p as any).model === 'string';
}

Try / catch

try {
  resolveRunModelOverrides(profile, overrides);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Model override')) {
    console.error('Fix the malformed override entry:', e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling resolveRunModelOverrides where an override value like `tier='x'` expands (or is given directly) to a RawAliasEntry with an unknown provider, missing model, empty string, or extra/invalid fields — anything normalizeStrictRunModelPreset rejects.

Common situations: YAML/env run overrides like `MODEL_OVERRIDE_reasoning='gpt-5'` omitting the provider; unsupported provider slug ('open ai', 'anthropicx'); trailing whitespace or quoting artifacts; copying a preset shape from an older Archon version with fields that no longer exist.

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.

Related errors


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

Appendix: source

Thrown at packages/adapters/src/community/forge/gitea/adapter.ts:419

  /**
   * Fetch comment history from issue or PR
   * Returns comments in chronological order (oldest first)
   */
  private async fetchCommentHistory(
    owner: string,
    repo: string,
    number: number
  ): Promise<string[]> {
    try {
      const url = `${this.baseUrl}/api/v1/repos/${owner}/${repo}/issues/${String(number)}/comments`;
      const response = await fetch(url, {
        headers: {
          Authorization: `token ${this.token}`,
        },
      });

      if (!response.ok) {
        throw new Error(`Gitea API error: ${String(response.status)}`);
      }

      const comments = (await response.json()) as {
        user?: { login: string } | null;
        body?: string | null;
      }[];

      // Gitea returns comments in chronological order by default
      // Take last 20 for context
      return comments.slice(-20).map(comment => {
        const author = comment.user?.login ?? 'unknown';
        const body = comment.body ?? '';
        return `${author}: ${body}`;
      });
    } catch (error) {
      getLog().error(
        { err: error, owner, repo, issueNumber: number },
        'comment_history_fetch_failed'

View on GitHub (pinned to 0773b97458)