invoke-ai/InvokeAI · error · HTTPException
Failed to update image
Error message
Failed to update image
What it means
HTTP 400 raised by PATCH /i/{image_name} when ApiDependencies.invoker.services.images.update() throws. The endpoint first checks image ownership and image-move maintenance state, so a 400 here typically means the update itself failed (bad change shape, image not found, or metadata constraint violated).
Source
Thrown at invokeai/app/api/routers/images.py:303
@images_router.patch(
"/i/{image_name}",
operation_id="update_image",
response_model=ImageDTO,
)
def update_image(
current_user: CurrentUserOrDefault,
image_name: str = Path(description="The name of the image to update"),
image_changes: ImageRecordChanges = Body(description="The changes to apply to the image"),
) -> ImageDTO:
"""Updates an image"""
_assert_image_owner(image_name, current_user)
assert_image_move_maintenance_inactive()
try:
return ApiDependencies.invoker.services.images.update(image_name, image_changes)
except Exception:
raise HTTPException(status_code=400, detail="Failed to update image")
@images_router.get(
"/i/{image_name}",
operation_id="get_image_dto",
response_model=ImageDTO,
)
def get_image_dto(
current_user: CurrentUserOrDefault,
image_name: str = Path(description="The name of image to get"),
) -> ImageDTO:
"""Gets an image's DTO"""
_assert_image_read_access(image_name, current_user)
try:
return ApiDependencies.invoker.services.images.get_dto(image_name)
except ImageRecordNotFoundException:
# Only a genuinely missing record answers 404. This route is what a workflow's imageView on GitHub (pinned to 0b6a024f2f)
Solutions
- Confirm image_name exists via GET /api/v1/images/i/{image_name} first
- Validate image_changes against the current ImageRecordChanges schema
- Check the image is not in a board under image-move maintenance
- Retry after refreshing the image list if the name was stale
Example fix
// before
await api.patch(`/images/i/${name}`, { changes: { starred: 'yes' } });
// after
await api.patch(`/images/i/${name}`, { changes: { starred: true } }); Defensive patterns
Strategy: validation
Validate before calling
// fetch the image first and validate the change shape
const dto = await api.getImageDto(name); // throws 404 if missing
if (typeof changes.starred !== 'boolean') throw new Error('starred must be boolean'); Try / catch
try {
await api.updateImage(name, changes);
} catch (e) {
if (e instanceof ApiError && e.status === 400) {
// refresh image existence and change schema, then retry once
}
} Prevention
- Always GET the image DTO before PATCHing to confirm it exists
- Keep the client SDK in sync with the server API version
- Validate ImageRecordChanges fields against the current schema
- Handle 'image moved to maintenance' states before updating
When it happens
Trigger: PATCH /api/v1/images/i/{image_name} with image_changes referencing nonexistent fields/categories, a nonexistent image_name, or a service-level write failure.
Common situations: Client sends stale image_name after the image was deleted; changing board/category to a board the image cannot move to; schema drift between client SDK version and server API version.
Related errors
- Failed to remove image from board
- Failed to get intermediates
- Failed to delete images
- Failed to star images
- Failed to unstar images
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/c426d784ec8e0151.
Report an issue: GitHub.