{"record":{"id":"b211e39c693f5201","repo":"HumanSignal/label-studio","slug":"there-are-no-tasks-for-request-user","errorCode":null,"errorMessage":"There are no tasks for {request.user}","messagePattern":"There are no tasks for (.+?)","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"warning","filePath":"label_studio/data_manager/actions/next_task.py","lineNumber":28,"sourceCode":"from tasks.serializers import NextTaskSerializer\n\nlogger = logging.getLogger(__name__)\n\n\ndef next_task(project, queryset, **kwargs):\n    \"\"\"Generate next task for labeling stream\n\n    :param project: project\n    :param queryset: task ids to sample from\n    :param kwargs: arguments from api request\n    \"\"\"\n\n    request = kwargs['request']\n    dm_queue = filters_ordering_selected_items_exist(request.data)\n    next_task, queue_info = get_next_task(request.user, queryset, project, dm_queue)\n\n    if next_task is None:\n        raise NotFound(f'There are no tasks for {request.user}')\n\n    # serialize task\n    context = {'request': request, 'project': project, 'resolve_uri': True, 'annotations': False}\n    serializer = NextTaskSerializer(next_task, context=context)\n    response = serializer.data\n    response['queue'] = queue_info\n    return response\n\n\nactions: list[DataManagerAction] = [\n    {\n        'entry_point': next_task,\n        'permission': all_permissions.projects_view,\n        'title': 'Generate Next Task',\n        'order': 0,\n        'hidden': True,\n    }\n]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_manager/actions/next_task.py#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Empty project; overly narrow data manager filters; all tasks already annotated at max overlap; drafts/deleted tasks; queue partitioning leaving a user with nothing.","solutions":["Check the project has tasks (queryset is non-empty) before requesting next_task","Clear or broaden the DM filters/queue payload (dm_queue from filters_ordering_selected_items_exist)","Check labeling settings: overlap, task assignment, and whether existing annotations consume all tasks","Handle 404 client-side and show an 'all done' state"],"exampleFix":"// before\nawait sdk.startLabeling({project: 1});  // 404 no tasks\n// after\nconst count = await sdk.getTaskCount({project: 1});\nif (count > 0) await sdk.startLabeling({project: 1});","handlingStrategy":"try-catch","validationCode":"const {count} = await api.get(`/api/projects/${projectId}/tasks?page_size=1`);\nif (!count) console.warn('project has no tasks');","typeGuard":"null","tryCatchPattern":"try {\n  const {task, queue} = await dm.getNextTask();\n  openTask(task);\n} catch (e) {\n  if (e.status === 404) showAllDoneScreen();\n  else throw e;\n}","preventionTips":["Check task count and queue filters before requesting the next task","Treat 404 as a normal 'queue empty' state, not a crash","Review overlap/assignment settings when users report empty queues"],"tags":["label-studio","data-manager","not-found","queue"],"backgroundTag":"resource-not-found","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}