Exceptions#

This page contains a list of exceptions that are thrown by BentoML.

class bentoml.exceptions.BentoMLException(message: str, *, error_code: HTTPStatus | None = None)[source]#

Base class for all BentoML’s errors. Each custom exception should be derived from this class.

class bentoml.exceptions.RemoteException(message: str, payload: BentoMLException | None = None)[source]#

A special exception that is used to wrap the exception from remote server

class bentoml.exceptions.InvalidArgument(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when BentoML received unexpected/invalid arguments from CLI arguments, HTTP Request, or python API function parameters.

class bentoml.exceptions.MissingDependencyException(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when BentoML component failed to load required dependencies.

Some BentoML components have optional dependencies that can be installed as extensions.

For example, when using the JSON IODescriptor, pydantic is considered as an optional feature if users want to use it to validate. BentoML will still work without pydantic installed.

class bentoml.exceptions.InternalServerError(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when BentoML received valid arguments from CLI arguments, HTTP Request, or python API function parameters, but got internal issues while processing.

  • Note to BentoML developers: raise this exception only when exceptions happend

in the users’ code (runner or service) and want to surface it to the user.

class bentoml.exceptions.NotFound(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when specified resource or name not found

class bentoml.exceptions.BadInput(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when API server receiving bad input request

class bentoml.exceptions.ServiceUnavailable(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when incoming requests exceeds the capacity of a server

class bentoml.exceptions.BentoMLConfigException(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when BentoML is mis-configured or when required configuration is missing

class bentoml.exceptions.ImportServiceError(message: str, *, error_code: HTTPStatus | None = None)[source]#

Raised when BentoML failed to import the user’s service file.