HumanSignal/label-studio · error · DataManagerException
Source annotation {source_annotation_id} not found in the cu
Error message
Source annotation {source_annotation_id} not found in the current project What it means
propagate_annotations copies a source annotation's results to other tasks in the project. It looks up Annotation.objects.filter(project=project, id=source_annotation_id) from request.data and raises DataManagerException if no annotation matches, i.e. the id is absent, malformed, or belongs to another project.
Source
Thrown at label_studio/data_manager/actions/experimental.py:25
from data_manager.actions import DataManagerAction
from data_manager.functions import DataManagerException
from django.conf import settings
from rest_framework.exceptions import ValidationError
from tasks.functions import bulk_create_annotations_with_side_effects
from tasks.models import Annotation, Task
from tasks.serializers import TaskSerializerBulk
logger = logging.getLogger(__name__)
all_permissions = AllPermissions()
def propagate_annotations(project, queryset, **kwargs):
request = kwargs['request']
user = request.user
source_annotation_id = request.data.get('source_annotation_id')
annotations = Annotation.objects.filter(project=project, id=source_annotation_id)
if not annotations:
raise DataManagerException(f'Source annotation {source_annotation_id} not found in the current project')
source_annotation = annotations.first()
tasks = set(queryset.values_list('id', flat=True))
try:
tasks.remove(source_annotation.task.id)
except KeyError:
pass
# copy source annotation to new annotations for each task
db_annotations = []
for i in tasks:
body = {
'task_id': i,
'completed_by_id': user.id,
'result': source_annotation.result,
'result_count': source_annotation.result_count,
'parent_annotation_id': source_annotation.id,
'project': project,View on GitHub (pinned to 0b49e9b539)
Solutions
- Fetch a valid annotation id from the project first (GET annotations for the source task) and pass it as source_annotation_id
- Confirm the annotation belongs to the same project as the action's project parameter
- Handle the DataManagerException client-side and re-select a source annotation
Example fix
// before
POST {"action": "propagate_annotations", "source_annotation_id": 99999} // not in project
// after
const id = sourceTask.annotations[0].id;
POST {"action": "propagate_annotations", "source_annotation_id": id} Defensive patterns
Strategy: validation
Validate before calling
const ann = await api.getAnnotation(projectId, sourceAnnotationId);
if (!ann || ann.project !== projectId) {
throw new Error(`Annotation ${sourceAnnotationId} not in project ${projectId}`);
} Type guard
function isAnnotationInProject(ann, projectId) { return ann != null && ann.project === projectId; } Try / catch
try {
await dm.addAction({id: 'propagate_annotations', source_annotation_id: id});
} catch (e) {
if (String(e).includes('not found in the current project')) {
await reselectSourceAnnotation();
} else throw e;
} Prevention
- Always obtain source_annotation_id from a fresh query of the project's annotations
- Never reuse ids across projects; validate project ownership before posting
- Handle deleted annotations (stale ids) gracefully in the UI
When it happens
Trigger: Calling the propagate_annotations DataManager action without 'source_annotation_id' in request.data, with a nonexistent id, or with an id from a different project; stale id after the annotation was deleted.
Common situations: Client caches an annotation id that was later deleted; cross-project UI copy-paste; missing payload field; id passed as string vs int confusion is not an issue here but wrong-project ids are.
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
- sample() does not accept arguments.
- random(min, max) requires two arguments.
- choices(values:list, weights:list) requires one or two argum
- replace(old_value, new_value) requires two arguments.
- Undefined expression, you can use: {add_data_field_examples}
AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29).
Data as JSON: /api/errors/12d5be7253038a78.
Report an issue: GitHub.