immich-app/immich · error · ValueError

Unknown model combination: {source}, {model_type}, {model_ta

Error message

Unknown model combination: {source}, {model_type}, {model_task}

What it means

Raised as ValueError by get_model_class (models/__init__.py) when the (model_source, model_type, model_task) triple does not match any of the supported case branches. Model source is derived from the model name via get_model_source; the valid combinations are openclip/mclip visual+search, openclip/mclip textual+search, insightface detection/recognition+facial-recognition, and paddle detection/recognition+ocr.

Source

Thrown at machine-learning/immich_ml/models/__init__.py:40

            return OpenClipTextualEncoder

        case ModelSource.MCLIP, ModelType.TEXTUAL, ModelTask.SEARCH:
            return MClipTextualEncoder

        case ModelSource.INSIGHTFACE, ModelType.DETECTION, ModelTask.FACIAL_RECOGNITION:
            return FaceDetector

        case ModelSource.INSIGHTFACE, ModelType.RECOGNITION, ModelTask.FACIAL_RECOGNITION:
            return FaceRecognizer

        case ModelSource.PADDLE, ModelType.DETECTION, ModelTask.OCR:
            return TextDetector

        case ModelSource.PADDLE, ModelType.RECOGNITION, ModelTask.OCR:
            return TextRecognizer

        case _:
            raise ValueError(f"Unknown model combination: {source}, {model_type}, {model_task}")


def from_model_type(model_name: str, model_type: ModelType, model_task: ModelTask, **kwargs: Any) -> InferenceModel:
    return get_model_class(model_name, model_type, model_task)(model_name, **kwargs)


def get_model_deps(model_name: str, model_type: ModelType, model_task: ModelTask) -> list[tuple[ModelType, ModelTask]]:
    return get_model_class(model_name, model_type, model_task).depends

View on GitHub (pinned to 199723261c)

Solutions

  1. Use a model name whose (source, type, task) is one of the supported combinations — see the match statement in models/__init__.py.
  2. Correct the modelName and/or the task/type fields in the request/config to a valid combination.
  3. Upgrade the ML service if a newer model family is officially supported.

Example fix

# before
from_model_type('buffalo_l', ModelType.RECOGNITION, ModelTask.OCR)  # wrong family

# after
from_model_type('buffalo_l_recognizer', ModelType.RECOGNITION, ModelTask.FACIAL_RECOGNITION)
Defensive patterns

Strategy: validation

Validate before calling

from immich_ml.models import get_model_class
from immich_ml.schemas import ModelSource, ModelType, ModelTask
try:
    cls = get_model_class(name, model_type, model_task)
except ValueError:
    # not a supported combination; reject early
    raise

Type guard

def is_supported_combination(source, model_type, model_task) -> bool:
    try:
        get_model_class('probe', model_type, model_task) if False else None
        return True
    except Exception:
        return False  # (wrap a lookup against the same match statement)

Try / catch

try:
    model = from_model_type(name, model_type, model_task)
except ValueError as e:
    if 'Unknown model combination' in str(e): pick_default_model()
    raise

Prevention

When it happens

Trigger: A request or config references a model whose source+type+task triple is unsupported — e.g. a Paddle OCR model requested with task=facial-recognition, or a CLIP model requested as type=detection.

Common situations: Misconfigured model name that maps to an unexpected source; mixing task/type fields in a custom request; new model family not yet wired into the match statement (version drift).

Related errors


AI-assisted analysis of immich-app/immich@199723261c (2026-08-12). Data as JSON: /api/errors/906712ed089e7eb4. Report an issue: GitHub.