Skip to content

bug(platform): an organization's own knowledge-database outage answers as the platform's DATABASE_UNAVAILABLE and goes unreported #4040

Closed as not planned

Description

@yannickmonney

Summary

An organization's own knowledge database (bring-your-own, routed through getKnowledgePoolForOrg) can become unreachable. The request then answers the platform's 503 DATABASE_UNAVAILABLE ("The platform's database is not answering right now — it may be restarting; retry with backoff") with Retry-After: 5, and nothing is reported. Since #4033 the browser drops DATABASE_UNAVAILABLE too. So a persistent outage of a customer's knowledge host reaches no error tracking at all, and the person is told the platform's database is restarting.

Found by the independent review of #4031 (TALE-416, note c). I verified the paths in source on main 929e9b162.

Mechanism

  • isDatabaseUnavailable (backend/db/unavailable.ts, from fix(platform): answer a database restart with 503, not a crash or 500 #3506) counts any postgres.js connection error as the platform database being unavailable. That covers the stamped ECONNREFUSED, ECONNRESET, EAI_AGAIN, ENOTFOUND, ETIMEDOUT, CONNECT_TIMEOUT and 57P01/02/03 errors.
  • The knowledge pools are postgres.js too, so their failures carry the same stamps.
  • fix(platform): wait out a restarting database when the backend boots #4031 adds EHOSTUNREACH and ENETUNREACH, for the platform database's sake. That widens the same behaviour, for example to a BYO host that is down on the LAN.
  • An error that escapes a door then meets databaseUnavailableResponse in appErrorHandler or the REST onError, which answers the 503 and reports nothing.

Two paths reach a BYO knowledge database (from the review):

  • POST /api/app/knowledge/search → core/knowledge/search.ts bindOrg → getKnowledgePoolForOrg, pinDimensions
  • PATCH /api/app/websites/:id (scan-interval change) → domains/websites/service.ts syncScanIntervalToCorpus → getKnowledgePoolForOrg

The website scan lane already tells a knowledge-database outage apart (isConnectionFailure in core/knowledge/pool.ts, #3049). The request doors do not.

Expected

  • A knowledge-database outage is not described as the platform's database restarting.
  • An outage of an organization's own knowledge database that persists is reported once.

Options (needs a decision)

  • A distinct code. The knowledge pool layer marks its errors with their origin, and the doors answer a distinct code, for example KNOWLEDGE_DATABASE_UNAVAILABLE, with a sentence that names the organization's knowledge database. That is a REST error-code registry and contract change.
  • A server-side report. Report a BYO knowledge outage once per outage, at warning level, the way /events reports a long platform outage.

Refs #3506, #4031, #4033.

Activity

  1. yannickmonney commented on Oct 1, 2026

    @yannickmonney
    ContributorAuthor

    Consolidating this concurrent report into #4037, which already includes the BYO request paths, default knowledge database, jobs and ended-pool case. The decision is recorded at #4037 (comment): classify by database origin and retain bounded, sanitized reporting. This report adds the useful existing website-scan classifier reference (#3049); keep it as supporting evidence on the canonical issue. Closing as a duplicate, not as fixed. No implementation or production validation is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions