Exceptions

Exceptions raised by the v2 client.

All exceptions inherit from FlowApiError, which carries the HTTP status code and error message from the response.

exception flowbio.v2.exceptions.FlowApiError(status_code, message, details=None, code=None, problem=None)

Bases: Exception

Base exception for all Flow API errors.

Raised when the API returns a non-success HTTP response. Carries the status code and error message from the response body.

Parameters:
  • status_code (int) – The HTTP status code from the response.

  • message (str | dict[str, list[str]]) – The error message — either a string or a dict of field-level errors (e.g. {"field": ["error message"]}).

  • details (list[dict] | None) – Optional per-location problems behind the error. From a Problem Details body, each is a {"pointer" | "parameter", "code", "detail"} dict, where pointer is a JSON Pointer into the request body and parameter names a query or path parameter. A legacy endpoint’s error envelope gives {"field", "code", "message"} dicts instead. None when the response names no locations.

  • code (str | None) – The stable machine-readable kind of problem (e.g. "validation_error", "not_found") from a Problem Details body, for branching on instead of the message text. None when the response is not a problem. Treat an unrecognised code as the generic error for its status.

  • problem (dict | None) – The Problem Details body exactly as the server sent it, including members this client does not read (type, title, instance), so it can be passed on unparsed. None when the response is not a problem.

Example:

try:
    client.samples.get("missing")
except FlowApiError as error:
    if error.code == "not_found":
        ...
exception flowbio.v2.exceptions.AuthenticationError(status_code, message, details=None, code=None, problem=None)

Bases: FlowApiError

Raised when the API returns a 401 Unauthorized response.

exception flowbio.v2.exceptions.BadRequestError(status_code, message, details=None, code=None, problem=None)

Bases: FlowApiError

Raised when the API refuses a request as invalid: a 400 Bad Request response, or a 422 through its UnprocessableError subclass.

exception flowbio.v2.exceptions.UnprocessableError(status_code, message, details=None, code=None, problem=None)

Bases: BadRequestError

Raised when the API returns a 422 Unprocessable Content response.

The request was well formed but the API refused its values, such as a name already in use; details locates each part of the request at fault. It is a BadRequestError, so code handling invalid input as a bad request catches it too.

exception flowbio.v2.exceptions.AnnotationValidationError(errors)

Bases: BadRequestError

Raised when the annotation upload in upload_multiplexed_data() returns hard validation errors, or when annotation upload is told not to ignore warnings.

The annotation endpoint returns {"validation": [...]} with status 400 for errors that cannot be ignored (as opposed to warnings which can, unless they are not configured to be ignored).

Parameters:

errors (list[dict]) – List of validation error dicts from the response.

exception flowbio.v2.exceptions.NotFoundError(status_code, message, details=None, code=None, problem=None)

Bases: FlowApiError

Raised when the API returns a 404 Not Found response.