{"record":{"id":"c0457412c333e8f3","repo":"coleam00/Archon","slug":"no-chat-in-context","errorCode":null,"errorMessage":"No chat in context","messagePattern":"No chat in context","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/chat/telegram/adapter.ts","lineNumber":143,"sourceCode":"   * Get the configured streaming mode\n   */\n  getStreamingMode(): 'stream' | 'batch' {\n    return this.streamingMode;\n  }\n\n  /**\n   * Get platform type\n   */\n  getPlatformType(): string {\n    return 'telegram';\n  }\n\n  /**\n   * Extract conversation ID from Telegram context\n   */\n  getConversationId(ctx: Context): string {\n    if (!ctx.chat) {\n      throw new Error('No chat in context');\n    }\n    return ctx.chat.id.toString();\n  }\n\n  /**\n   * Ensure responses go to a thread.\n   * Telegram doesn't have threads - each chat is a persistent conversation.\n   * Returns original conversation ID unchanged.\n   */\n  async ensureThread(originalConversationId: string, _messageContext?: unknown): Promise<string> {\n    return originalConversationId;\n  }\n\n  /**\n   * Register a message handler for incoming messages\n   * Must be called before start()\n   */\n  onMessage(handler: (ctx: TelegramMessageContext) => Promise<void>): void {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/chat/telegram/adapter.ts#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the supported tier list from the error message and fix the spelling/casing of the tier name in your config or call site.","Run a quick check with isTierName(name) (exported from packages/workflows) before passing the value.","If the tier was removed in an upgrade, migrate to the new tier name per the release notes.","If you need a non-tier model target, use a custom '@'-prefixed alias or a 'provider/model' spec instead of a tier name."],"exampleFix":"// before\nresolveRunModelOverrides(profile, { coding: 'codng' });\n// after\nresolveRunModelOverrides(profile, { coding: 'coding' });","handlingStrategy":"type-guard","validationCode":"import { isTierName } from '@archon/workflows/model-validation';\nif (!isTierName(cfg.tier)) throw new Error(`bad tier: ${cfg.tier}`);","typeGuard":"import { isTierName, type TierName } from '@archon/workflows/model-validation';\nfunction asTierName(v: string): TierName {\n  if (!isTierName(v)) throw new Error(`invalid tier '${v}'`);\n  return v;\n}","tryCatchPattern":"try {\n  resolveRunModelOverrides(profile, overrides);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('is invalid. Supported tiers')) {\n    // fall back to defaults or re-prompt for a valid tier\n  } else throw e;\n}","preventionTips":["Always build tier references from the TierName type, not raw strings","Parse config values through isTierName at load time","Run `bunx tsc --noEmit` so string-literal typos in typed positions fail compile","When upgrading Archon, diff the TIER_NAMES list against your configs"],"tags":["configuration","validation","model-tier"],"backgroundTag":"invalid-enum-value","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}