Skip to content

Unexpected

Safe fallback exceptions for unclassified multimodal failures.

ComponentUnexpectedError(*, error_type, detail, component=None, next_step=None, debug_info=None)

Bases: _UnexpectedErrorMessage, ComponentError

Fallback for unclassified component setup or availability failures.

Use this when startup fails and no specific component error covers the cause. Pass only a safe summary of the original cause.

Example

A backend raises an unfamiliar error while it initializes.

from textwrap import fill
from gllm_multimodal.exceptions import ComponentUnexpectedError

error = ComponentUnexpectedError(
    error_type="RuntimeError",
    detail="the backend could not initialize",
    component="video decoder",
)
print(fill(error.message, width=100))
Output:
The video decoder failed with RuntimeError: the backend could not initialize. Check component
configuration and installation, then contact the application owner if it persists.

MediaUnexpectedError(*, error_type, detail, component=None, next_step=None, debug_info=None)

Bases: _UnexpectedErrorMessage, MediaError

Fallback for unclassified failures about media input or its source.

Use this when a media source fails in a way that no specific media error describes. Pass only a safe summary of the original cause.

Example

Reading a media source raises an unfamiliar transport error.

from textwrap import fill
from gllm_multimodal.exceptions import MediaUnexpectedError

error = MediaUnexpectedError(
    error_type="TransportError",
    detail="the source connection closed unexpectedly",
)
print(fill(error.message, width=100))
Output:
The media input failed with TransportError: the source connection closed unexpectedly. Check the
media input and processing options. If the issue persists, contact the application owner.

MediaUnexpectedOperationError(*, error_type, detail, component=None, next_step=None, debug_info=None)

Bases: _UnexpectedErrorMessage, MediaOperationError

Fallback for unclassified failures while performing a media operation.

Example

Use this when a media operation fails for an unclassified reason and you want to include the cause and affected component in the error.

from textwrap import fill
from gllm_multimodal.exceptions import MediaUnexpectedOperationError

error = MediaUnexpectedOperationError(
    error_type="RuntimeError",
    detail="decoder returned no frames",
    component="frame extraction",
)
print(fill(error.message, width=100))
Output:
The frame extraction operation failed with RuntimeError: decoder returned no frames. Check the media
input and processing options. If the issue persists, contact the application owner.