HumanSignal/label-studio · error · ValidationError

Invalid SkipQueue value: {self.project.skip_queue}

Error message

Invalid SkipQueue value: {self.project.skip_queue}

What it means

Task.get_lock_exclude_query() builds the Q filter deciding how skipped (was_cancelled) annotations affect task locking, based on project.skip_queue. If skip_queue holds a value that is not one of SkipQueue.IGNORE_SKIPPED, REQUEUE_FOR_ME, or REQUEUE_FOR_OTHERS, ValidationError is raised because the task-locking behavior is undefined for that value.

Source

Thrown at label_studio/tasks/models.py:283

        Get query for excluding annotations from the lock check
        """
        SkipQueue = self.project.SkipQueue

        if self.project.skip_queue == SkipQueue.IGNORE_SKIPPED:
            # IGNORE_SKIPPED: my skipped tasks don't go anywhere
            # alien's and my skipped annotations are counted as regular annotations
            q = Q()
        else:
            if self.project.skip_queue == SkipQueue.REQUEUE_FOR_ME:
                # REQUEUE_FOR_ME means: only my skipped tasks go back to me,
                # alien's skipped annotations are counted as regular annotations
                q = Q(was_cancelled=True) & Q(completed_by=user)
            elif self.project.skip_queue == SkipQueue.REQUEUE_FOR_OTHERS:
                # REQUEUE_FOR_OTHERS: my skipped tasks go to others
                # alien's skipped annotations are not counted at all
                q = Q(was_cancelled=True) & ~Q(completed_by=user)
            else:
                raise ValidationError(f'Invalid SkipQueue value: {self.project.skip_queue}')

            # for LSE we also need to exclude rejected queue
            rejected_q = self.get_rejected_query()

            if rejected_q:
                q &= rejected_q

        return q | Q(ground_truth=True)

    def has_lock(self, user=None):
        """
        Check whether current task has been locked by some user

        Also has workaround for fixing not consistent is_labeled flag state
        """
        from projects.functions.next_task import get_next_task_logging_level

        if self.project.annotator_evaluation_enabled:

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Inspect the offending project: Project.objects.get(id=<id>).skip_queue and compare with projects.models.SkipQueue enum values
  2. Reset the project's skip_queue to a valid enum value (e.g. via Django admin or Project.objects.filter(id=<id>).update(skip_queue=SkipQueue.IGNORE_SKIPPED))
  3. Check SkipQueue enum for renames between versions and write a data migration mapping old values to new ones
  4. Fix whatever wrote the invalid value (import script / API call) to use SkipQueue enum members

Example fix

// before
project.skip_queue = 'requeue'  # not an enum member
// after
from projects.models import Project, SkipQueue
project.skip_queue = SkipQueue.REQUEUE_FOR_ME
project.save(update_fields=['skip_queue'])
Defensive patterns

Strategy: validation

Validate before calling

from projects.models import SkipQueue

def assert_skip_queue_valid(project):
    valid = {SkipQueue.IGNORE_SKIPPED, SkipQueue.REQUEUE_FOR_ME, SkipQueue.REQUEUE_FOR_OTHERS}
    if project.skip_queue not in valid:
        raise ValueError(f"project {project.id} has invalid skip_queue={project.skip_queue!r}")

Type guard

def has_valid_skip_queue(project) -> bool:
    from projects.models import SkipQueue
    try:
        return project.skip_queue in {SkipQueue.IGNORE_SKIPPED, SkipQueue.REQUEUE_FOR_ME, SkipQueue.REQUEUE_FOR_OTHERS}
    except Exception:
        return False

Try / catch

from rest_framework.exceptions import ValidationError
try:
    locked = task.has_lock(user=user)
except ValidationError as e:
    logger.error("bad skip_queue on project %s: %s", project.id, e)
    locked = False  # or repair skip_queue first

Prevention

When it happens

Trigger: Calling task.has_lock(user) (or get_lock_exclude_query) on a task whose project.skip_queue column contains an unrecognized value — e.g. legacy/renamed enum value persisted in the DB, a value written by an older version, manual DB edit, or import that bypassed enum validation.

Common situations: Restoring a DB dump from an older Label Studio version whose SkipQueue enum differed; migrating data between instances; manual SQL updates to project.skip_queue; custom scripts writing raw strings into the column.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29). Data as JSON: /api/errors/1ca83e483b4702b7. Report an issue: GitHub.