koala73/worldmonitor · error · Error

military live seed read failed

Error message

military live seed read failed

What it means

listMilitaryFlights first tries a stable live-seed snapshot from Redis via fetchStableLiveSeedSnapshot. If that returns status 'error' — a genuine Redis read/command failure rather than a cache miss — the handler throws 'military live seed read failed' before calling OpenSky, so the outer catch can serve stale data instead of fanning out a per-bbox OpenSky request storm during a Redis outage. The throw is deliberate: ambiguity between 'missing' and 'broken' must not trigger provider recovery that is then globally cached.

Source

Thrown at server/worldmonitor/military/v1/list-military-flights.ts:537

  try {
    if (!req.neLat && !req.neLon && !req.swLat && !req.swLon) return emptyResponse();
    // #6249: a NaN/Infinity corner cannot be normalized into a meaningful
    // bbox; answer empty instead of letting it reach the relay as garbage.
    if (!hasFiniteRequestBounds(req)) return emptyResponse();
    const requestBounds = normalizeBounds(req);

    // The live seed is the source of truth for an authoritatively covered
    // snapshot. Its value is independent of this request's bbox, so returning
    // it through the bbox-keyed provider cache would duplicate the same full
    // snapshot under every viewport key. Use one shared stable snapshot before
    // judging payload-declared coverage so numeric cursors survive another
    // edge isolate without making provider recovery globally cacheable.
    const seeded = await fetchStableLiveSeedSnapshot();
    if (seeded.status === 'error') {
      // A Redis command/read failure is not proof the snapshot is missing.
      // Throw before any provider call so the catch can consult stale data
      // without turning a Redis outage into per-bbox OpenSky fanout.
      throw new Error('military live seed read failed');
    }
    if (seeded.status === 'hit' && seedCovers(seeded.coverage, requestBounds)) {
      return paginateResponseForCaller(ctx, seeded.flights, [], requestBounds, req);
    }

    // A miss, or a hit whose coverage does not contain this request (for
    // example, a regional snapshot asked about the Americas), needs
    // request-specific recovery. That response is genuinely bbox-dependent.

    // Quantize bbox to a 1° grid so nearby map views share cache entries.
    // Precise coordinates caused near-zero hit rate since every pan/zoom created a unique key.
    // Key by the quantized bbox only. The cached value is the complete
    // expanded-cell snapshot, so page size and cursor must NOT fragment it —
    // every page/cursor for the same cell shares one upstream fetch and one
    // entry, and pagination is applied per-request after retrieval.
    const cacheKey = `${buildCacheKey(req)}${redistributableOnly ? ':redistributable' : ''}`;

    const fullResult = await cachedFetchJson<ListMilitaryFlightsResponse>(

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Restore Redis availability: check Upstash health, credentials, and quotas; the error is a symptom of the seed read failing
  2. Confirm the outer handler's stale-data path serves the last known snapshot instead of hitting OpenSky
  3. Add alerting on seed-read failures so Redis regressions are caught before traffic spikes
  4. If Redis is healthy, inspect fetchStableLiveSeedSnapshot for bugs that misclassify hits/misses as errors

Example fix

// before
const seeded = await fetchStableLiveSeedSnapshot();
if (seeded.status === 'error') throw new Error('military live seed read failed');
// after (consumer)
try { ... } catch (e) {
  if (String(e).includes('military live seed read failed')) return serveStaleSnapshot();
  throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

// Check Redis reachability before requesting military flights
const redisOk = await pingRedis();
if (!redisOk) prewarmStaleSnapshotElsewhere();

Type guard

function isSeedReadFailure(e: unknown): boolean {
  return e instanceof Error && e.message === 'military live seed read failed';
}

Try / catch

try {
  return await listMilitaryFlights(ctx, req);
} catch (e) {
  if (isSeedReadFailure(e)) return serveStaleSnapshot(req); // never fan out to OpenSky here
  throw e;
}

Prevention

When it happens

Trigger: fetchStableLiveSeedSnapshot resolves { status: 'error' } because the underlying Redis get (e.g. Upstash HTTP 4xx/5xx, command error, or timeout) failed while handling listMilitaryFlights with any request bbox.

Common situations: Upstash outage or credential rotation in production; Redis timeout under load; network partition between the edge isolate and Redis; Redis quota exhaustion returning 429.

Related errors


AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-09-01). Data as JSON: /api/errors/b6f96500d68bbcb6. Report an issue: GitHub.