invoke-ai/InvokeAI · warning · HTTPException

You do not have permission to delete this queue item

Error message

You do not have permission to delete this queue item

What it means

HTTPException(403) raised in DELETE /session_queue/{queue_id}/i/{item_id} when the authenticated user is neither the owner of the queue item chain's root item nor an admin. Authorization is deliberately based on the root owner because the delete removes the entire workflow-call chain.

Source

Thrown at invokeai/app/api/routers/session_queue.py:604

def delete_queue_item(
    current_user: CurrentUserOrDefault,
    queue_id: str = Path(description="The queue id to perform this operation on"),
    item_id: int = Path(description="The queue item to delete"),
) -> None:
    """Deletes a queue item. Users can only delete their own items unless they are an admin."""
    try:
        # Get the queue item to check ownership
        queue_item = ApiDependencies.invoker.services.session_queue.get_queue_item(item_id)
        if queue_item.queue_id != queue_id:
            raise HTTPException(status_code=404, detail=f"Queue item with id {item_id} not found in queue {queue_id}")

        root_queue_item = _get_workflow_call_root_queue_item(queue_item)
        if root_queue_item.queue_id != queue_id:
            raise HTTPException(status_code=404, detail=f"Queue item with id {item_id} not found in queue {queue_id}")

        # The queue service deletes the entire chain, so authorization must use the root owner.
        if root_queue_item.user_id != current_user.user_id and not current_user.is_admin:
            raise HTTPException(status_code=403, detail="You do not have permission to delete this queue item")

        ApiDependencies.invoker.services.session_queue.delete_queue_item(item_id)
    except SessionQueueItemNotFoundError:
        raise HTTPException(status_code=404, detail=f"Queue item with id {item_id} not found in queue {queue_id}")
    except HTTPException:
        raise
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Unexpected error while deleting queue item: {e}")


@session_queue_router.put(
    "/{queue_id}/i/{item_id}/cancel",
    operation_id="cancel_queue_item",
    responses={
        200: {"model": SessionQueueItem},
    },
)
def cancel_queue_item(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Have an admin perform the delete, or log in as the user who owns the root queue item
  2. If the token should own the items, re-enqueue using the intended user's credentials
  3. Ask the server admin to grant admin rights if this account legitimately needs to manage all queue items

Example fix

// before: delete as wrong user -> 403
await api.delete(`/api/v1/session_queue/${queueId}/i/${itemId}`)
// after: check ownership client-side first
if (rootItem.user_id !== currentUser.id && !currentUser.is_admin) {
  throw new Error('Not permitted; ask an admin or the owner')
}
Defensive patterns

Strategy: validation

Validate before calling

// check ownership before attempting delete
const item = await api.get(`/api/v1/session_queue/${queueId}/i/${itemId}`)
if (item.data.user_id !== currentUser.id && !currentUser.is_admin) {
  throw new Error('Only the owner or an admin can delete this queue item')
}

Type guard

function canDelete(item, currentUser) {
  return currentUser?.is_admin === true || item?.user_id === currentUser?.id
}

Try / catch

try {
  await api.delete(`/api/v1/session_queue/${queueId}/i/${itemId}`)
} catch (e) {
  if (e.response?.status === 403) {
    notify('You lack permission to delete this item; ask an admin or the owner')
  } else throw e
}

Prevention

When it happens

Trigger: A non-admin user calling DELETE on a queue item whose root_queue_item.user_id differs from their own user_id — e.g. deleting another user's queued generation in a shared/multi-user InvokeAI deployment.

Common situations: Multi-user setups where users share queue visibility but not delete rights; service accounts or API tokens running as a different user than the one who enqueued the item; sessions switching users while a UI keeps old items loaded.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/d2b55eff2cdbadfb. Report an issue: GitHub.