invoke-ai/InvokeAI · error · PermissionError

Queue user is not authorized to save images

Error message

Queue user is not authorized to save images

What it means

ImagesInterface.save throws PermissionError in multiuser mode when the queue item's user account is missing or deactivated. Deactivation revokes all queue-time privileges, including saving outputs of already-running graphs.

Source

Thrown at invokeai/app/services/shared/invocation_context.py:239

        metadata_ = None
        if metadata:
            metadata_ = metadata.model_dump_json()
        elif isinstance(self._data.invocation, WithMetadata) and self._data.invocation.metadata:
            metadata_ = self._data.invocation.metadata.model_dump_json()

        # If `board_id` is provided directly, use that. Else, use the board provided by `WithBoard`, falling back to None.
        board_id_ = None
        if board_id:
            board_id_ = board_id
        elif isinstance(self._data.invocation, WithBoard) and self._data.invocation.board:
            board_id_ = self._data.invocation.board.board_id

        if self._services.configuration.multiuser:
            user = self._services.users.get(self._data.queue_item.user_id)
            # A deactivated or deleted account must not save outputs, even
            # uncategorized ones — deactivation revokes queue-time privileges.
            if user is None or not user.is_active:
                raise PermissionError("Queue user is not authorized to save images")
            if board_id_ is not None:
                board = self._services.boards.get_dto(board_id_)
                if (
                    not user.is_admin
                    and board.user_id != self._data.queue_item.user_id
                    and board.board_visibility != BoardVisibility.Public
                ):
                    raise PermissionError("Queue user is not authorized to save images to this board")

        workflow_ = None
        if self._data.queue_item.workflow:
            workflow_ = self._data.queue_item.workflow.model_dump_json()

        graph_ = None
        if self._data.queue_item.session.graph:
            graph_ = self._data.queue_item.session.graph.model_dump_json()

        return self._services.images.create(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Reactivate the user account before the queue item reaches its save step
  2. Cancel/purge that user's pending queue items before deactivating the account
  3. Run the generation under an active account
  4. Catch PermissionError around images.save and skip persisting the output

Example fix

# before
class DeactivatedUserWorkflow:
    def invoke(self, context):
        context.images.save(image)  # raises PermissionError
# after: ensure user active or catch
def invoke(self, context):
    try:
        context.images.save(image)
    except PermissionError:
        logger.warning("user deactivated; output not saved")
Defensive patterns

Strategy: try-catch

Validate before calling

cfg = services.configuration
user = services.users.get(queue_item.user_id) if cfg.multiuser else True
if cfg.multiuser and (user is None or not user.is_active):
    raise SkipSave("queue user deactivated")

Type guard

def can_save(services, queue_item) -> bool:
    if not services.configuration.multiuser:
        return True
    user = services.users.get(queue_item.user_id)
    return user is not None and user.is_active

Try / catch

try:
    context.images.save(image, board_id=board_id)
except PermissionError:
    logger.warning("save rejected: queue user lacks privileges")

Prevention

When it happens

Trigger: An invocation calls images.save (optionally with board_id) while self._services.configuration.multiuser is true and users.get(queue_item.user_id) returns None or a user with is_active=False.

Common situations: Admin bans/deletes a user mid-run; their in-flight queue items hit the save step and fail; long-running batches spanning account deactivation.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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