{"record":{"id":"bf2e586974fe970f","repo":"paperclipai/paperclip","slug":"database-unreachable","errorCode":"database_unreachable","errorMessage":"database_unreachable","messagePattern":"database_unreachable","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"server/src/routes/health.ts","lineNumber":305,"sourceCode":"              commit,\n              ...(cloud ? { cloud } : {}),\n              ...(hiddenSettings.length ? { hiddenSettings } : {}),\n            },\n      );\n      return;\n    }\n\n    try {\n      await db.execute(sql`SELECT 1`);\n    } catch (error) {\n      logger.warn({ err: error }, \"Health check database probe failed\");\n      // Carry readiness on the unhealthy response too: the seed phase recorded on\n      // disk is exactly what tells an operator whether this is a half-finished\n      // restore or a database that died after being verified.\n      const workspace = exposeWorkspaceReadiness\n        ? await resolveWorkspaceReadiness({ db, handoffSubject }).catch(() => null)\n        : null;\n      res.status(503).json({\n        status: \"unhealthy\",\n        version: serverVersion,\n        serverVersion,\n        commit,\n        error: \"database_unreachable\",\n        ...(exposeFullDetails ? { serverInfo } : {}),\n        ...(workspace ? { workspace } : {}),\n        ...(cloud ? { cloud } : {}),\n      });\n      return;\n    }\n\n    let bootstrapStatus: \"ready\" | \"bootstrap_pending\" = \"ready\";\n    let bootstrapInviteActive = false;\n    // Cloud-managed instances have no first-admin concept: the control\n    // plane owns identity and its trusted-header users are deliberately\n    // never instance_admin, so the role-count gate below would report\n    // bootstrap_pending forever and lock every managed tenant out at the","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/health.ts#L287-L323","documentation":"The health endpoint's SELECT 1 database probe threw; the database is unreachable, and the unhealthy response still carries workspace readiness info so an operator can distinguish a half-finished restore from a dead database.","triggerScenarios":"Thrown at server/src/routes/health.ts:176 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the health/connectivity of the backing service (database, dev server supervisor, storage), fix the underlying fault, and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-21T17:58:32.592Z","contentChangedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}