{"record":{"id":"ce2dbe18753d8147","repo":"cube-js/cube","slug":"server-unavailable-no-new-requests-accepted-durin","errorCode":null,"errorMessage":"Server unavailable, no new requests accepted during shutdown","messagePattern":"Server unavailable, no new requests accepted during shutdown","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"packages/cubejs-server/src/graceful-middleware.ts","lineNumber":12,"sourceCode":"import { RequestHandler } from 'express';\nimport { ServerStatusHandler } from './server-status';\n\nexport function gracefulMiddleware(status: ServerStatusHandler, timeout: number): RequestHandler {\n  // eslint-disable-next-line consistent-return\n  return (req, res, next) => {\n    if (status.isUp()) {\n      return next();\n    }\n\n    // https://tools.ietf.org/html/rfc7231#section-6.6.4\n    res.status(503)\n      .header('Connection', 'close')\n      // Timeout can be bigger then 5 sec, let's allow client to retry in 5sec\n      .header('Retry-After', `${Math.max(timeout, 5)}`)\n      .json({\n        message: 'Server unavailable, no new requests accepted during shutdown',\n      });\n  };\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server/src/graceful-middleware.ts#L1-L21","documentation":"Not a thrown error: the graceful-shutdown middleware in cubejs-server responds 503 (with Retry-After and Connection: close headers) for any incoming request when the server status handler reports the server is no longer up (shutting down or starting), per RFC 7231 §6.6.4, telling clients to retry later.","triggerScenarios":"Thrown at packages/cubejs-server/src/graceful-middleware.ts:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clients should honor the Retry-After header and retry the request after the indicated interval.","Check server lifecycle state — the message appears during graceful shutdown or readiness delay, not a request error.","If it appears unexpectedly, verify the server wasn't stopped or crashed and that the status handler timeout is configured correctly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}