Python SDK

Errors

The error envelope and status codes returned by Python Serve.

Every error from a served route uses the same envelope as the TypeScript Serve runtime:

{
  "error": {
    "type": "UNAUTHORIZED",
    "message": "Access denied",
    "details": { "reason": "missing_credentials" }
  }
}

Error responses are sent with Cache-Control: no-store and an x-request-id.

Error types

StatustypeWhen
400VALIDATION_ERRORInvalid body, unknown fields, or an unknown dimension or measure
401UNAUTHORIZEDMissing or rejected credentials
403FORBIDDENMissing role or scope, or a tenant policy mismatch
404NOT_FOUNDUnknown path or method
413PAYLOAD_TOO_LARGEBody or result over its byte limit
429RATE_LIMITEDRate limit exhausted
503SERVICE_UNAVAILABLEAuthentication down, the server at capacity, or ClickHouse rejecting the server's own credentials or permissions (the reason goes to the server log with the request id)
504GATEWAY_TIMEOUTRequest or query deadline missed
500INTERNAL_SERVER_ERRORUnexpected failure

Validation errors are 400 with details.issues[].path, as in TypeScript. Submitted values are never echoed back. Endpoints with a strict client profile (client_profile=) answer any invalid query with the fixed message Invalid client query. and no details. They also answer 409 with details.code CLIENT_SCHEMA_CHANGED when the caller's schema pin is stale.

Raising errors from your routes

from hypequery.serve import Call, ServeError, ServeResponse


async def report(call: Call) -> ServeResponse:
    raise ServeError(404, "NOT_FOUND", "Report not found")
  • ServeError(status, type, message, *, details=None, headers=None) is sent as written, like TypeScript's ServeHttpError.
  • A dataset query error maps its category to a status and type, for example a missed deadline becomes 504 GATEWAY_TIMEOUT.
  • Anything else is logged to the hypequery.serve logger with its request id and answered with a fixed 500. The failure's own text never reaches the response body.

On this page

Get early access to hypequery cloud.

Cloud hosts the same model you run in your backend, with a managed API and MCP server, versions, and rollback. We're letting teams in a few at a time. Join the waitlist and we'll reach out when your project can go live.

How do you want to build your analytics layer? (Optional)
What features do you most need? (Optional)

Pick as many as you like.

Only your email is required. All other questions are optional.