invoke-ai/InvokeAI · error · HTTPException

str(e) (Exception during conversion)

Error message

str(e) (Exception during conversion)

What it means

HTTP 409 raised when any exception occurs during the checkpoint→diffusers conversion/install step inside _convert_model. Before raising, the original model's temporary '.DELETE' rename is rolled back so the source checkpoint keeps its name. The detail is simply str(e) of the underlying failure (disk full, corrupted checkpoint, install-path conflict, loader OOM, etc.).

Source

Thrown at invokeai/app/api/routers/model_manager.py:1338

        # Install and claim the diffusers before allowing another request to observe its key.
        with contextlib.ExitStack() as conversion_stack:
            try:
                new_key = conversion_stack.enter_context(
                    _install_and_claim_model(
                        installer,
                        convert_path,
                        config=ModelRecordChanges(
                            name=original_name,
                            description=model_config.description,
                            hash=model_config.hash,
                            source=model_config.source,
                        ),
                    )
                )
            except Exception as e:
                logger.error(str(e))
                store.update_model(key, changes=ModelRecordChanges(name=original_name))
                raise HTTPException(status_code=409, detail=str(e))

            # Update the model image if the model had one.
            try:
                model_image = ApiDependencies.invoker.services.model_images.get(key)
                ApiDependencies.invoker.services.model_images.save(model_image, new_key)
                ApiDependencies.invoker.services.model_images.delete(key)
            except ModelImageFileNotFoundException:
                pass

            # Delete the original safetensors file.
            installer.delete(key)

            # Return the config record for the new diffusers directory.
            new_config = store.get_model(new_key)
            new_config = prepare_model_config_for_response(new_config, ApiDependencies)
            return new_config

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Read the logged error (logger.error(str(e))) — the 409 detail carries the underlying exception text
  2. Check free disk space: conversion writes the full diffusers copy under models_path before installing
  3. Retry the conversion — the original model name is restored automatically, so the model remains usable
  4. If it repeatedly fails, reload/validate the checkpoint file or re-download it
  5. Check for leftover '.DELETE'-named or scratch-dir leftovers under models_path and clean them
Defensive patterns

Strategy: try-catch

Validate before calling

const cfg = await api.getModelConfig(key);
if (!cfg || cfg.format !== 'checkpoint') throw new Error('not convertible');
// also: ensure adequate free disk space on models_path host before converting

Try / catch

try {
  const converted = await api.convertModel(key);
} catch (e) {
  if (e.status === 409) {
    console.error('Conversion failed, original model restored:', e.body?.detail);
    // surface e.body.detail — it carries the underlying exception
  } else throw e;
}

Prevention

When it happens

Trigger: Any exception from _install_and_claim_model or save_pretrained during POST /models/convert/{key}: corrupted safetensors checkpoint, insufficient disk space in models_path, name/source collision when installing the new diffusers folder, or model load failure.

Common situations: Full or slow scratch disk under models_path; half-deleted models leaving install-path conflicts; checkpoints incompatible with the loader (quantized, broken shards); out-of-memory when loading a large XL checkpoint to convert.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/299375aa7a1381c3. Report an issue: GitHub.