coleam00/Archon · error

No chat in context

Error message

No chat in context

What it means

Archon's model-validation module resolves AI model bindings through named 'tiers' (e.g. reasoning, coding, fast) that map to concrete provider models. assertValidTierName validates any tier reference before use and throws when the given name is not one of the registered TierName values. The error lists every supported tier so the developer can correct the spelling.

Source

Thrown at packages/adapters/src/chat/telegram/adapter.ts:143

   * Get the configured streaming mode
   */
  getStreamingMode(): 'stream' | 'batch' {
    return this.streamingMode;
  }

  /**
   * Get platform type
   */
  getPlatformType(): string {
    return 'telegram';
  }

  /**
   * Extract conversation ID from Telegram context
   */
  getConversationId(ctx: Context): string {
    if (!ctx.chat) {
      throw new Error('No chat in context');
    }
    return ctx.chat.id.toString();
  }

  /**
   * Ensure responses go to a thread.
   * Telegram doesn't have threads - each chat is a persistent conversation.
   * Returns original conversation ID unchanged.
   */
  async ensureThread(originalConversationId: string, _messageContext?: unknown): Promise<string> {
    return originalConversationId;
  }

  /**
   * Register a message handler for incoming messages
   * Must be called before start()
   */
  onMessage(handler: (ctx: TelegramMessageContext) => Promise<void>): void {

View on GitHub (pinned to 0773b97458)

Solutions

  1. Read the supported tier list from the error message and fix the spelling/casing of the tier name in your config or call site.
  2. Run a quick check with isTierName(name) (exported from packages/workflows) before passing the value.
  3. If the tier was removed in an upgrade, migrate to the new tier name per the release notes.
  4. If you need a non-tier model target, use a custom '@'-prefixed alias or a 'provider/model' spec instead of a tier name.

Example fix

// before
resolveRunModelOverrides(profile, { coding: 'codng' });
// after
resolveRunModelOverrides(profile, { coding: 'coding' });
Defensive patterns

Strategy: type-guard

Validate before calling

import { isTierName } from '@archon/workflows/model-validation';
if (!isTierName(cfg.tier)) throw new Error(`bad tier: ${cfg.tier}`);

Type guard

import { isTierName, type TierName } from '@archon/workflows/model-validation';
function asTierName(v: string): TierName {
  if (!isTierName(v)) throw new Error(`invalid tier '${v}'`);
  return v;
}

Try / catch

try {
  resolveRunModelOverrides(profile, overrides);
} catch (e) {
  if (e instanceof Error && e.message.includes('is invalid. Supported tiers')) {
    // fall back to defaults or re-prompt for a valid tier
  } else throw e;
}

Prevention

When it happens

Trigger: Calling buildAiProfile or resolveRunModelOverrides with a tier name that fails isTierName(): a typo (e.g. 'reasning'), wrong casing ('Coding'), a tier removed/renamed in a newer version, or a free-form string passed from YAML config or an environment variable without validation.

Common situations: Hand-editing workflow YAML with a tier override like `tier: primay`; upgrading Archon after a tier was renamed; copying tier names from docs of a different project; building the profile programmatically from user input that was never constrained to TierName.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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