Skip to content

Configuration

Configuration errors shared by media processors, converters, and transformers.

ComponentConfigError(*, component, parameter, next_step, debug_info=None)

Bases: ComponentError, ValueError

Report an invalid or missing option for any multimodal component.

Use this during component setup when a required setting is absent or invalid, before a media operation starts.

Example

A converter is created without a required model name.

from gllm_multimodal.exceptions import ComponentConfigError

error = ComponentConfigError(
    component="Audio transcription",
    parameter="model_name",
    next_step="Configure a supported model name and try again.",
)
print(error.message)
Output:
Audio transcription needs a valid model_name. Configure a supported model name and try again.

Initialize the error with the component, option, and corrective action.

Parameters:

Name Type Description Default
component str

Name of the component with invalid or missing configuration.

required
parameter str

Required option or setting that needs correction.

required
next_step str

Action for supplying or correcting the parameter.

required
debug_info DebugInfo | None

Optional diagnostic context, sanitized before storage.

None

from_validation_error(error, *, component, subject, default_parameter, debug_info=None) classmethod

Create the error from a pydantic validation failure of the component's configuration.

The error names the first offending field and repeats pydantic's reason in its next step. An unknown option, or a failure that is not tied to one field, is reported against default_parameter.

Example

A processor is configured with a non-positive frame rate.

error = ComponentConfigError.from_validation_error(
    validation_error,
    component="GstFrameSamplingProcessor",
    subject="GstFrameSamplingConfig options",
    default_parameter="config",
)
print(error.message)
Output:
GstFrameSamplingProcessor needs a valid default_target_fps. Check the GstFrameSamplingConfig options: default_target_fps must be greater than 0.

Parameters:

Name Type Description Default
error ValidationError

The pydantic validation failure.

required
component str

Name of the component with invalid configuration.

required
subject str

What the caller should check, named in the next step, such as "GstFrameSamplingConfig options" or "target_fps argument".

required
default_parameter str

Parameter reported when the failure is not tied to a single valid field.

required
debug_info DebugInfo | None

Optional diagnostic context, sanitized before storage.

None

Returns:

Type Description
Self

The configuration error. The caller raises it from error.

ComponentModelError(*, model, failure, debug_info=None)

Bases: ComponentError, RuntimeError

Report failure to obtain or prepare model weights during component setup.

Use this when downloading, caching, or verifying model weights fails.

Example

A detector downloads a built-in model, but the received file fails integrity verification.

from textwrap import fill
from gllm_multimodal.exceptions import ComponentModelError

error = ComponentModelError(model="ppocrv6_small", failure="integrity")
print(fill(error.message, width=100))
Output:
The ppocrv6_small model could not be prepared: its weights failed integrity verification. Retry the
download; if it repeats, ask the application owner to verify the model artifact.

Initialize a model preparation error with a specific recovery action.

Parameters:

Name Type Description Default
model str

Safe model identifier, without a directory path.

required
failure str

One of download, cache, lock, size_limit, integrity, or local_file.

required
debug_info DebugInfo | None

Optional diagnostic context, sanitized before storage.

None

Raises:

Type Description
ValueError

If the identifier or failure category is invalid.