diegosouzapw/OmniRoute · error
SERVICE_UNAVAILABLE
SERVICE_UNAVAILABLE
Error message
Server is shutting down
What it means
The authz pipeline saw the server in draining (shutdown) state and returned its canned 503 SERVICE_UNAVAILABLE response (with correlation id and Retry-After: 5) instead of processing the request. Any request arriving during graceful shutdown gets this sentinel.
Solutions
- Retry against a restarted instance after the deployment completes
- Honor the Retry-After header before resending
- Route traffic to another instance during rolling restarts
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/server/authz/pipeline.ts:201 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/52f552b5596cb53c.
Report an issue: GitHub.
Appendix: source
Thrown at src/server/authz/pipeline.ts:201
}
console.error("[Authz] JWT auto-refresh failed:", error);
}
}
function dashboardLoginRedirect(request: NextRequest, requestId: string): NextResponse {
const response = NextResponse.redirect(new URL(`${request.nextUrl.basePath}/login`, request.url));
response.cookies.delete("auth_token");
stampRouteResponse(response, requestId, "MANAGEMENT");
applyCorsHeaders(response, request);
return response;
}
function drainingResponse(requestId: string): NextResponse {
const response = NextResponse.json(
{
error: {
code: "SERVICE_UNAVAILABLE",
message: "Server is shutting down",
correlation_id: requestId,
},
},
{ status: 503 }
);
response.headers.set(AUTHZ_HEADER_REQUEST_ID, requestId);
response.headers.set("Retry-After", "5");
return response;
}
function invalidOriginResponse(requestId: string): NextResponse {
const response = NextResponse.json(
{
error: {
code: "INVALID_ORIGIN",
message:
"Invalid request origin. Same-origin dashboard writes must include a valid dashboard CSRF token. " +View on GitHub (pinned to a179ffed5b)