Error Codes
WebSocket trade push uses channel error codes returned by the WebSocket gateway layer during authentication or low-level request handling. Code values are integers in the 4xxx / 5xxx range.
Channel Error Codes
Channel errors occur before the request reaches business logic, and are returned by the WebSocket gateway or authentication service.
Response Format
json
{
"id": "req-001",
"code": 4002,
"msg": "auth_failed"
}Error Code Reference
| code | Meaning | Common Cause | Recommended Action |
|---|---|---|---|
4000 | Malformed request | The frame structure does not conform to the protocol — e.g., invalid JSON or missing action field. | Check the request frame format and resend after fixing. |
4001 | Not authenticated | A business request was sent before authentication succeeded. | Complete Auth authentication first; send business requests only after receiving session_id. |
4002 | Authentication failed | credential_id does not exist, signature verification failed, or the Bearer Token is expired or invalid. | Check credentials and signing logic. For OAuth2, refresh the token and re-establish the connection. |
4003 | Insufficient permissions | The authorization scope of the current credential does not include the requested interface permission. | Verify that the credential is authorized for the interface; for OAuth2, check the scope requested during authorization. |
4004 | Interface not found | action is incorrect, or the requested interface is not exposed by the server. | Check the API documentation and verify the action name spelling. |
5000 | Internal server error | An unexpected exception occurred while the server was processing the request. | Contact the server team for investigation; automatic retry is not recommended. |
5002 | Gateway error | A server-side network error prevented the request from reaching the backend. | Retry after a short delay; if the issue persists, check the network environment or contact the server team. |
5003 | Service temporarily unavailable | The server is overloaded and temporarily unable to handle new requests. | Wait and retry; use a backoff strategy. |
5004 | Request timeout | The server did not return a result within the allotted time. | Retry after a short delay; if timeouts persist, contact the server team for investigation. |