{"record":{"id":"fe7c8232df0a4264","repo":"invoke-ai/InvokeAI","slug":"you-do-not-have-permission-to-retry-queue-item-it","errorCode":null,"errorMessage":"You do not have permission to retry queue item {item_id}","messagePattern":"You do not have permission to retry queue item (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"invokeai/app/api/routers/session_queue.py","lineNumber":403,"sourceCode":") -> RetryItemsResult:\n    \"\"\"Retries the given queue items. Users can only retry their own items unless they are an admin.\"\"\"\n    try:\n        # Check queue membership for all items and ownership for non-admins.\n        valid_item_ids: list[int] = []\n        for item_id in item_ids:\n            try:\n                queue_item = ApiDependencies.invoker.services.session_queue.get_queue_item(item_id)\n                if queue_item.queue_id != queue_id:\n                    raise HTTPException(\n                        status_code=404, detail=f\"Queue item with id {item_id} not found in queue {queue_id}\"\n                    )\n                root_queue_item = _get_workflow_call_root_queue_item(queue_item)\n                if root_queue_item.queue_id != queue_id:\n                    raise HTTPException(\n                        status_code=404, detail=f\"Queue item with id {item_id} not found in queue {queue_id}\"\n                    )\n                if not current_user.is_admin and root_queue_item.user_id != current_user.user_id:\n                    raise HTTPException(\n                        status_code=403, detail=f\"You do not have permission to retry queue item {item_id}\"\n                    )\n                valid_item_ids.append(item_id)\n            except SessionQueueItemNotFoundError:\n                # Skip items that don't exist - they will be handled by retry_items_by_id\n                continue\n\n        return ApiDependencies.invoker.services.session_queue.retry_items_by_id(\n            queue_id=queue_id, item_ids=valid_item_ids\n        )\n    except HTTPException:\n        raise\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Unexpected error while retrying queue items: {e}\")\n\n\n@session_queue_router.put(\n    \"/{queue_id}/clear\",","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/session_queue.py#L385-L421","documentation":"A 403 raised when a non-admin user attempts to retry a queue item whose root queue item was created by a different user. Ownership is enforced on the root of the workflow-call chain, so even items you can see may be un-retryable if the originating item belongs to another user.","triggerScenarios":"PUT retry_items_by_id as a non-admin where root_queue_item.user_id != current_user.user_id for any requested id.","commonSituations":"Shared InvokeAI instance with multiple users; scripts running under one account retrying items queued by another; token/auth misconfiguration causing requests to be attributed to the wrong user.","solutions":["Have the owning user (or an admin) perform the retry.","Log in with the account that originally enqueued the item.","Ensure your auth token maps to the expected user (check current_user via the API) — stale tokens often attribute calls to the wrong account.","Filter requested item ids to those you own before calling the endpoint."],"exampleFix":"// before\nrequests.put(url, json={\"item_ids\": item_ids})\n// after: only retry items whose root owner is the current user\nmine = [i for i in item_ids if get_root_owner(i) == current_user_id]\nrequests.put(url, json={\"item_ids\": mine})","handlingStrategy":"validation","validationCode":"// only request items owned by the current user (non-admin)\nconst owned = itemIds.filter(id => rootOwner(id) === currentUserId);\nif (owned.length === 0) throw new Error('no retryable items owned by current user');","typeGuard":"function canRetry(item, user) {\n  return user.is_admin || item?.root?.user_id === user.user_id;\n}","tryCatchPattern":"try {\n  const r = await retry(owned);\n  if (r.status === 403) console.error('retry forbidden: item owned by another user');\n} catch (e) {\n  if (e.status === 403) {\n    // request the owner or an admin to retry, or switch accounts\n  }\n}","preventionTips":["Check item ownership before retry on shared instances","Confirm your auth token maps to the expected user","Route cross-user retries through an admin","Filter id lists to your own items client-side"],"tags":["http-403","permissions","auth","queue"],"backgroundTag":"insufficient-permissions","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}