{"record":{"id":"3395236458249f1e","repo":"invoke-ai/InvokeAI","slug":"failed-to-star-images","errorCode":null,"errorMessage":"Failed to star images","messagePattern":"Failed to star images","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/images.py","lineNumber":703,"sourceCode":"                # Deleted by a concurrent session — a skip, not a storage failure. See\n                # delete_images_from_list. Reachable here through the get_dto read-back inside\n                # ImageService.update: the UPDATE itself matches no row and raises nothing, so\n                # a name that vanished mid-batch surfaces only on the read that follows.\n                continue\n            except Exception:\n                # A genuine storage failure, not an auth/404 skip: it used to be swallowed\n                # by `pass`, so the client counted the image as starred and the star\n                # silently vanished on reload.\n                failed_images.add(image_name)\n        return StarredImagesResult(\n            starred_images=list(starred_images),\n            failed_images=list(failed_images),\n            affected_boards=list(affected_boards),\n        )\n    except HTTPException:\n        raise\n    except Exception:\n        raise HTTPException(status_code=500, detail=\"Failed to star images\")\n\n\n@images_router.post(\"/unstar\", operation_id=\"unstar_images_in_list\", response_model=UnstarredImagesResult)\ndef unstar_images_in_list(\n    current_user: CurrentUserOrDefault,\n    image_names: list[ImageName] = Body(\n        description=\"The list of names of images to unstar\", embed=True, max_length=MAX_IMAGE_BATCH_SIZE\n    ),\n) -> UnstarredImagesResult:\n    try:\n        assert_image_move_maintenance_inactive()\n    except HTTPException:\n        for image_name in image_names:\n            _assert_image_owner(image_name, current_user)\n        raise\n\n    try:\n        # See star_images_in_list: skip foreign names instead of re-raising mid-batch, and","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/images.py#L685-L721","documentation":"HTTP 500 raised by POST /images/star when starring the listed image_names throws an unexpected exception. Individual image failures are captured in failed_images within the result, so this error indicates the whole request crashed in the service layer.","triggerScenarios":"POST /api/v1/images/star with image_names the service cannot update — corrupted records, DB failure, or nonexistent images in a way that aborts rather than being recorded as failed.","commonSituations":"Batch contains names of images deleted moments before; sqlite lock contention during heavy queue use; stale client state from another session that removed the images.","solutions":["Check server logs for the underlying error","Re-fetch the image list and star only images that still exist","Retry with a smaller batch to isolate the offending image","Verify database integrity/writability"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const existing = new Set((await api.getImageDtos(imageNames)).map(i => i.image_name));\nconst validNames = imageNames.filter(n => existing.has(n));","typeGuard":null,"tryCatchPattern":"try {\n  const res = await api.starImagesInList(validNames);\n} catch (e) {\n  if (e instanceof ApiError && e.status === 500) {\n    // halve the batch and retry to isolate the failing image\n  }\n}","preventionTips":["Verify image names exist before bulk star/unstar","Keep batches small to reduce lock contention","Refresh client state after other sessions modify images","Avoid bulk writes while the queue is heavily active"],"tags":["http-500","api","invokeai"],"backgroundTag":"bulk-star-failed","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}