Skip to content
Source
Sign inSign up
TanStack/schemas

mistral: model page mistral-medium-3-5-26-04 throws "replacement has no API name" after #782 #783 (GitHub #782)

Opentombeckenham opened this issue 1 comment
tombeckenhamcommented

Regression from #782 (#771). PostHog ingest_failed providerId=mistral, mistral catalog mistral-medium-3-5-26-04: replacement has no API name, first at 2026-11-27T09:06Z on the first poll after the 9fce7d2 deploy. The old Mistral failures have stopped.

parseMistralCatalog (src/server/providers/mistral-catalog.ts) throws when a record's replacedBy is an unpopulated Payload relation id (a number) and the same page never embeds the successor record. The model page for mistral-medium-3-5-26-04 (https://docs.mistral.ai/models/mistral-medium-3-5-26-04) apparently does that. A failed docs load is not cached, so this repeats every poll and the row's page facts stay unavailable.

Read the live page and decide. Either resolve the successor another way the page states (the overview catalog, which embeds every record), or, on a model page, stop treating the replacement as required: deprecations come from the overview, not the model page. Stay fail-closed for the overview. Bump DOCS_CACHE_VERSION (main is v52) if the parse changes.

  1. tombeckenham assignedtombeckenham

  2. tanstack-sourcecommented Only here. This is not on GitHub.

    Result: reproduced

    mistralPageCatalog throws mistral catalog mistral-medium-3-5-26-04: replacement has no API name for a model page whose record has replacedBy: 118 and no embedded successor. This matches the PostHog message in the issue.

    I could not read the live page: egress to docs.mistral.ai is blocked for this job (403 egress to docs.mistral.ai is not allowed for this job). The repro uses a payload row shaped like the record, so the trigger is the number relation id, not the page HTML.

    What I ran:

    1. parseMistralCatalog with one record that has replacedBy: 118: throws at src/server/providers/mistral-catalog.ts:292. The final map in parseMistralCatalog rejects every replacementUnread record, even when the page has no other copy.
    2. The same page plus a second copy of the record with a populated replacedBy works: replacementIds becomes ["mistral-large-4"]. So the current code only resolves the relation through a duplicate record on the same page.
    3. replacedBy: null parses and gives replacementIds: null, so the parser already accepts "no successor" on a page.
    4. In ingest, loadPage calls mistralPageCatalog(body, slug) at src/server/providers/mistral-pricing.ts:1565. The throw escapes cachedDocs, and cachedDocs writes KV only after load() returns, so nothing is cached. That is why the failure repeats every poll and the row keeps no release date, modalities, features or page price.

    The page states no successor name on the model page, so the issue's second option fits: on a model page, treat the unpopulated relation as "no successor". The overview keeps throwing, which src/server/providers/deprecations.test.ts already asserts for replacedBy: 100.

    Suspected files

    1. src/server/providers/mistral-catalog.ts: parseMistralCatalog (line 292 throw) and mistralPageCatalog (line 306). A page-level parse needs to tolerate replacementUnread.
    2. src/server/providers/mistral-pricing.ts:1565: loadPage is where the page parse fails the whole page cache entry.
    3. src/server/providers/model-facts.ts:312: DOCS_CACHE_VERSION = 'v52' needs a bump if the parse changes.

    Repro

    Path: repro/issue-783.test.mjs Command: node --test repro/issue-783.test.mjs

    import assert from 'node:assert/strict'
    import { test } from 'node:test'
    import {
      mistralPageCatalog,
      parseMistralCatalog,
    } from '../src/server/providers/mistral-catalog.ts'
    
    /** One RSC payload row holding catalog records, as docs.mistral.ai serves them. */
    function pageHtml(models) {
      const stream = `1:${JSON.stringify(models)}\n`
      return `<html><script>self.__next_f.push([1,${JSON.stringify(stream)}])</script></html>`
    }
    
    /** The record docs.mistral.ai/models/mistral-medium-3-5-26-04 embeds. */
    function mediumRecord(overrides = {}) {
      return {
        slug: 'mistral-medium-3-5-26-04',
        status: 'deprecated',
        modelIds: ['mistral-medium-3-5', 'mistral-medium-latest'],
        shortDescription: 'Balanced flagship.',
        deprecatedAt: '2026-10-31T00:00:00.000Z',
        retiredAt: '2027-04-30T00:00:00.000Z',
        // Payload's unpopulated relation: a number, not the successor record.
        replacedBy: 118,
        inputs: ['text'],
        outputs: ['text'],
        features: ['document-qna'],
        maxOutputTokens: null,
        releasedAt: '2026-04-28T12:00:00.000Z',
        pricing: [
          { direction: 'input', label: 'Input', unit: '/M Tokens', priceUsd: 1.5 },
          { direction: 'output', label: 'Output', unit: '/M Tokens', priceUsd: 7.5 },
        ],
        isFree: false,
        ...overrides,
      }
    }
    
    test('a model page whose record names an unpopulated replacement parses', () => {
      const page = mistralPageCatalog(
        pageHtml([mediumRecord()]),
        'mistral-medium-3-5-26-04',
      )
      assert.equal(page?.slug, 'mistral-medium-3-5-26-04')
      assert.equal(page?.replacementIds, null)
    })
    
    test('the overview stays fail-closed on an unpopulated replacement', () => {
      assert.throws(
        () => parseMistralCatalog(pageHtml([mediumRecord()])),
        /replacement has no API name/,
      )
    })

    Output (end):

    ℹ pass 1
    ℹ fail 1
    ℹ duration_ms 175.51244
    
    ✖ failing tests:
    
    test at repro/issue-783.test.mjs:39:1
    ✖ a model page whose record names an unpopulated replacement parses (4.618704ms)
      Error: mistral catalog mistral-medium-3-5-26-04: replacement has no API name
          at file:///workspace/repo/src/server/providers/mistral-catalog.ts:292:13
          at Array.map (<anonymous>)
          at parseMistralCatalog (file:///workspace/repo/src/server/providers/mistral-catalog.ts:290:31)
          at mistralPageCatalog (file:///workspace/repo/src/server/providers/mistral-catalog.ts:306:18)
          at TestContext.<anonymous> (file:///workspace/repo/repro/issue-783.test.mjs:40:16)

    TanStack Source bot, investigate agent

  3. tombeckenham linked this to #784

Sign in to join this conversation.