cube-js/cube · error

Server unavailable, no new requests accepted during shutdown

Error message

Server unavailable, no new requests accepted during shutdown

What it means

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.

Source

Thrown at packages/cubejs-server/src/graceful-middleware.ts:12

import { RequestHandler } from 'express';
import { ServerStatusHandler } from './server-status';

export function gracefulMiddleware(status: ServerStatusHandler, timeout: number): RequestHandler {
  // eslint-disable-next-line consistent-return
  return (req, res, next) => {
    if (status.isUp()) {
      return next();
    }

    // https://tools.ietf.org/html/rfc7231#section-6.6.4
    res.status(503)
      .header('Connection', 'close')
      // Timeout can be bigger then 5 sec, let's allow client to retry in 5sec
      .header('Retry-After', `${Math.max(timeout, 5)}`)
      .json({
        message: 'Server unavailable, no new requests accepted during shutdown',
      });
  };
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Clients should honor the Retry-After header and retry the request after the indicated interval.
  2. Check server lifecycle state — the message appears during graceful shutdown or readiness delay, not a request error.
  3. If it appears unexpectedly, verify the server wasn't stopped or crashed and that the status handler timeout is configured correctly.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-server/src/graceful-middleware.ts:12 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/ce2dbe18753d8147. Report an issue: GitHub.