HumanSignal/label-studio · warning · NotFound

There are no tasks for {request.user}

Error message

There are no tasks for {request.user}

What it means

next_task fetches the next task to label via get_next_task for the given user, project and DM filter queue. When no task matches the queue/filters (or the user has exhausted the queue under its settings), it raises Django REST framework NotFound. It means the queue resolved to zero assignable tasks, not a server failure.

Source

Thrown at label_studio/data_manager/actions/next_task.py:28

from tasks.serializers import NextTaskSerializer

logger = logging.getLogger(__name__)


def next_task(project, queryset, **kwargs):
    """Generate next task for labeling stream

    :param project: project
    :param queryset: task ids to sample from
    :param kwargs: arguments from api request
    """

    request = kwargs['request']
    dm_queue = filters_ordering_selected_items_exist(request.data)
    next_task, queue_info = get_next_task(request.user, queryset, project, dm_queue)

    if next_task is None:
        raise NotFound(f'There are no tasks for {request.user}')

    # serialize task
    context = {'request': request, 'project': project, 'resolve_uri': True, 'annotations': False}
    serializer = NextTaskSerializer(next_task, context=context)
    response = serializer.data
    response['queue'] = queue_info
    return response


actions: list[DataManagerAction] = [
    {
        'entry_point': next_task,
        'permission': all_permissions.projects_view,
        'title': 'Generate Next Task',
        'order': 0,
        'hidden': True,
    }
]

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Check the project has tasks (queryset is non-empty) before requesting next_task
  2. Clear or broaden the DM filters/queue payload (dm_queue from filters_ordering_selected_items_exist)
  3. Check labeling settings: overlap, task assignment, and whether existing annotations consume all tasks
  4. Handle 404 client-side and show an 'all done' state

Example fix

// before
await sdk.startLabeling({project: 1});  // 404 no tasks
// after
const count = await sdk.getTaskCount({project: 1});
if (count > 0) await sdk.startLabeling({project: 1});
Defensive patterns

Strategy: try-catch

Validate before calling

const {count} = await api.get(`/api/projects/${projectId}/tasks?page_size=1`);
if (!count) console.warn('project has no tasks');

Type guard

null

Try / catch

try {
  const {task, queue} = await dm.getNextTask();
  openTask(task);
} catch (e) {
  if (e.status === 404) showAllDoneScreen();
  else throw e;
}

Prevention

When it happens

Trigger: Calling GET next_task on a project with no tasks, with DM filters/ordering/selected-items that exclude every task, or when the labeling stream has no tasks left for that user per overlap/assignment settings.

Common situations: Empty project; overly narrow data manager filters; all tasks already annotated at max overlap; drafts/deleted tasks; queue partitioning leaving a user with nothing.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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