Error Codes
New disaster-server APIs should use the unified response envelope. Older endpoints or authentication middleware may still return msg; clients should handle both.
Response Envelope
{
"code": 0,
"message": "OK",
"data": {},
"meta": {},
"trace_id": "..."
}
Error response:
{
"code": 1000,
"message": "invalid request",
"data": null,
"meta": {},
"trace_id": "..."
}
Business Codes
| code | HTTP Status | Meaning | Suggested Handling |
|---|---|---|---|
0 | 200 | Success | Read data and meta |
1000 | 400 | Bad request | Check body, path params, query params |
2001 | 401 | Unauthorized or invalid token | Login again or refresh token |
2003 | 403 | Forbidden | Check user permissions, Server RBAC, remote cluster permissions |
3004 | 404 | Resource not found | Check name, namespace, cluster, route |
3009 | 409 | State conflict | Check whether the current state allows the action |
4000 | 502 | Upstream error | Check Kubernetes API, Velero, object storage, or remote cluster |
5000 | 500 | Internal server error | Use trace_id to search server logs |
Authentication Middleware Response
Authentication failures may return:
{
"code": 401,
"msg": "token is invalid"
}
Clients should handle both message and msg.
Troubleshooting
400: request schema or field names.401: token expiry or missingBearerprefix.403: user permissions, ServiceAccount, remote cluster RBAC.404: resource name and API group/version.409: instance or operation state machine.502: Kubernetes API, Velero, object storage, network.500: usetrace_idand server logs.