AUTOMATIC1111/stable-diffusion-webui · error · HTTPException
Image not found
Error message
Image not found
What it means
HTTP 404 raised by interrogateapi when the request body for /sdapi/v1/interrogate has no image field (interrogatereq.image is None). The image must be a base64 string (or URL/data URI when enabled) that decode_base64_to_image can turn into a PIL image for CLIP or deepdanbooru tagging.
Source
Thrown at modules/api/api.py:633
time_since_start = time.time() - shared.state.time_start
eta = (time_since_start/progress)
eta_relative = eta-time_since_start
progress = min(progress, 1)
shared.state.set_current_image()
current_image = None
if shared.state.current_image and not req.skip_current_image:
current_image = encode_pil_to_base64(shared.state.current_image)
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()
View on GitHub (pinned to 82a973c043)
Solutions
- Send {"image": "<base64>", "model": "clip"}
- Verify with a minimal curl before integrating: curl -X POST .../sdapi/v1/interrogate -d '{"image":"iVBOR...","model":"clip"}'
Example fix
# before
json={'model':'clip'}
# after
json={'model':'clip','image':base64.b64encode(open('a.png','rb').read()).decode()} Defensive patterns
Strategy: validation
Validate before calling
assert payload.get('image'), 'interrogate requires image: <base64>'
import base64; base64.b64decode(payload['image'], validate=True) # raises early on bad data Type guard
def is_valid_interrogate_payload(p: dict) -> bool:
return isinstance(p.get('image'), str) and len(p['image']) > 0 Prevention
- Use the exact field name 'image'
- Round-trip decode base64 before sending
- Smoke-test the endpoint after schema changes
When it happens
Trigger: POST /sdapi/v1/interrogate with {"model":"clip"} and no image key, or image explicitly null; Pydantic marks image optional so FastAPI won't 422 it first.
Common situations: Clients testing the interrogate endpoint with model only; payload field named 'image_b64' or 'init_images' instead of 'image'; JSON serialization dropping empty fields.
Related errors
- Model not found
- Init image not found
- Sampler not found
- Invalid encoded image
- always on script {alwayson_script_name} not found
AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14).
Data as JSON: /api/errors/3d416ed516c73656.
Report an issue: GitHub.