immich-app/immich · error · HTTPException

Task {entry['task']} of type {entry['type']} depends on outp

Error message

Task {entry['task']} of type {entry['type']} depends on output of {dep}

What it means

Raised as HTTPException(400) inside run_inference when a model declares a dependency on another model's output (model.depends) but that dependency's output is not yet present in the outputs map at the time the dependent runs. This indicates the dependency task was not requested or did not run before the dependent task.

Source

Thrown at machine-learning/immich_ml/main.py:199

    response = await run_inference(inputs, entries)
    return ORJSONResponse(response)


async def run_inference(payload: Image | str, entries: InferenceEntries) -> InferenceResponse:
    outputs: dict[ModelIdentity, Any] = {}
    response: InferenceResponse = {}

    async def _run_inference(entry: InferenceEntry) -> None:
        model = await model_cache.get(
            entry["name"], entry["type"], entry["task"], ttl=settings.model_ttl, **entry["options"]
        )
        inputs = [payload]
        for dep in model.depends:
            try:
                inputs.append(outputs[dep])
            except KeyError:
                message = f"Task {entry['task']} of type {entry['type']} depends on output of {dep}"
                raise HTTPException(400, message)
        model = await load(model)
        output = await run(model.predict, *inputs, **entry["options"])
        outputs[model.identity] = output
        response[entry["task"]] = output

    without_deps, with_deps = entries
    await asyncio.gather(*[_run_inference(entry) for entry in without_deps])
    if with_deps:
        await asyncio.gather(*[_run_inference(entry) for entry in with_deps])
    if isinstance(payload, Image):
        response["imageHeight"], response["imageWidth"] = payload.height, payload.width

    return response


async def run(func: Callable[..., T], *args: Any, **kwargs: Any) -> T:
    if thread_pool is None:
        return func(*args, **kwargs)

View on GitHub (pinned to 199723261c)

Solutions

  1. Include all prerequisite tasks in the same 'entries' request so their outputs populate before dependents run.
  2. Verify the model's depends list and ensure each dependency is requested.
  3. Use the Immich server's built-in pipeline builder rather than hand-crafting entries.

Example fix

# before — only the dependent task
entries = {"recognition": {"facial-recognition": {"modelName": "buffalo_l_recognizer"}}}

# after — include the detection dependency
entries = {
  "detection":     {"facial-recognition": {"modelName": "buffalo_l_detector"}},
  "recognition":   {"facial-recognition": {"modelName": "buffalo_l_recognizer"}},
}
Defensive patterns

Strategy: validation

Validate before calling

from immich_ml.models import get_model_deps
required = {dep for entry in entries for dep in get_model_deps(entry['name'], entry['type'], entry['task'])}
requested = {(e['type'], e['task']) for e in entries}
missing = required - requested
if missing: raise ValueError(f'missing dependency tasks: {missing}')

Type guard

def deps_satisfied(entries, outputs) -> bool:
    for e in entries:
        deps = get_model_class(e['name'], e['type'], e['task']).depends
        if any(d not in outputs for d in deps): return False
    return True

Try / catch

try:
    await run_inference(payload, entries)
except HTTPException as e:
    if 'depends on output of' in (e.detail or ''): include_missing_dependency_tasks()
    raise

Prevention

When it happens

Trigger: POST /predict whose 'entries' include a task that depends on another model's output (e.g. facial recognition depending on detection, or a textual encoder paired with a visual one) but the dependency task is missing from the same request, or dependency ordering failed.

Common situations: Custom/cut-down request omitting the prerequisite task; model combination where depends is set but the upstream model is not loaded in the same pipeline; version mismatch where depends metadata changed.

Related errors


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