AUTOMATIC1111/stable-diffusion-webui · error · HTTPException

Model not found

Error message

Model not found

What it means

HTTP 404 raised by interrogateapi when interrogatereq.model is neither 'clip' nor 'deepdanbooru'. Only those two literal strings are accepted; anything else (including case variants, 'DeepBooru', 'wd14', or empty) falls to the else branch. Note deepdanbooru additionally requires that subsystem to be available/installed.

Source

Thrown at modules/api/api.py:645

        return models.ProgressResponse(progress=progress, eta_relative=eta_relative, state=shared.state.dict(), current_image=current_image, textinfo=shared.state.textinfo, current_task=current_task)

    def interrogateapi(self, interrogatereq: models.InterrogateRequest):
        image_b64 = interrogatereq.image
        if image_b64 is None:
            raise HTTPException(status_code=404, detail="Image not found")

        img = decode_base64_to_image(image_b64)
        img = img.convert('RGB')

        # Override object param
        with self.queue_lock:
            if interrogatereq.model == "clip":
                processed = shared.interrogator.interrogate(img)
            elif interrogatereq.model == "deepdanbooru":
                processed = deepbooru.model.tag(img)
            else:
                raise HTTPException(status_code=404, detail="Model not found")

        return models.InterrogateResponse(caption=processed)

    def interruptapi(self):
        shared.state.interrupt()

        return {}

    def unloadapi(self):
        sd_models.unload_model_weights()

        return {}

    def reloadapi(self):
        sd_models.send_model_to_device(shared.sd_model)

        return {}

View on GitHub (pinned to 82a973c043)

Solutions

  1. Use exactly "clip" or "deepdanbooru" (lowercase) for the model field
  2. For anime-style tagging use a dedicated tagger extension's own API route rather than /sdapi/v1/interrogate
  3. Check GET /sdapi/v1/doc (OpenAPI) for the InterrogateRequest enum to confirm accepted values in your version

Example fix

# before
json={'image':b64,'model':'DeepDanbooru'}

# after
json={'image':b64,'model':'deepdanbooru'}
Defensive patterns

Strategy: validation

Validate before calling

if payload.get('model') not in ('clip', 'deepdanbooru'):
    payload['model'] = 'clip'  # or raise ValueError('model must be clip|deepdanbooru')

Type guard

def is_valid_interrogate_model(m: str | None) -> bool:
    return m in ('clip', 'deepdanbooru')

Prevention

When it happens

Trigger: POST /sdapi/v1/interrogate with model='DeepDanbooru' (wrong case), 'CLIP', 'wd14-vit', or omitted model; clients assuming newer tagger names are supported.

Common situations: Case-sensitive string mismatches; ported clients from tagger extensions; users expecting anime taggers that live in third-party extensions, not this endpoint.

Related errors


AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14). Data as JSON: /api/errors/3d4d52a59341790f. Report an issue: GitHub.