HumanSignal/label-studio · error · ValidationError
Wrong old label name, it is not from labeling config: {old_l
Error message
Wrong old label name, it is not from labeling config: {old_label_name} What it means
rename_labels renames a label across annotations by control tag. It parses the project's labeling config via project.get_parsed_config() and raises ValidationError if control_tag is not a key in the parsed labels map — meaning the given control tag (and old label) does not exist in the current labeling configuration.
Source
Thrown at label_studio/data_manager/actions/experimental.py:83
field = {
'type': 'number',
'name': 'source_annotation_id',
'label': 'Enter source annotation ID'
+ (f' [first ID: {str(first_annotation.id)}]' if first_annotation else ''),
}
return [{'columnCount': 1, 'fields': [field]}]
def rename_labels(project, queryset, **kwargs):
request = kwargs['request']
old_label_name = request.data.get('old_label_name')
new_label_name = request.data.get('new_label_name')
control_tag = request.data.get('control_tag')
labels = project.get_parsed_config()
if control_tag not in labels:
raise ValidationError('Wrong old label name, it is not from labeling config: ' + old_label_name)
label_type = labels[control_tag]['type'].lower()
annotations = Annotation.objects.filter(project=project)
if settings.DJANGO_DB == settings.DJANGO_DB_SQLITE:
annotations = annotations.filter(result__icontains=control_tag).filter(result__icontains=old_label_name)
else:
annotations = annotations.filter(result__contains=[{'from_name': control_tag}]).filter(
result__contains=[{'value': {label_type: [old_label_name]}}]
)
label_count = 0
annotation_count = 0
for annotation in annotations:
changed = False
for sub in annotation.result:
if sub.get('from_name', None) == control_tag and old_label_name in sub.get('value', {}).get(
label_type, []
):View on GitHub (pinned to 0b49e9b539)
Solutions
- Pass the exact control tag name from the labeling config (e.g. <Choices name="sentiment"> → control_tag "sentiment"), not the label value
- Verify with the parsed config (project.get_parsed_config()) that the tag exists before calling
- Update labeling config references if the tag was renamed
Example fix
// before
{"control_tag": "label", "old_label_name": "Positive", "new_label_name": "Good"} // config has <Choices name="sentiment">
// after
{"control_tag": "sentiment", "old_label_name": "Positive", "new_label_name": "Good"} Defensive patterns
Strategy: validation
Validate before calling
const parsed = project.get_parsed_config(); // or fetch config-derived labels via API
if (!(controlTag in parsed)) {
throw new Error(`control_tag ${controlTag} missing from labeling config`);
} Type guard
function controlTagExists(parsedConfig, tag) { return tag != null && Object.prototype.hasOwnProperty.call(parsedConfig, tag); } Try / catch
try {
await dm.addAction({id: 'rename_labels', control_tag: tag, old_label_name: oldL, new_label_name: newL});
} catch (e) {
if (String(e).includes('Wrong old label name')) {
promptRepickControlTag();
} else throw e;
} Prevention
- Populate the control-tag selector from the parsed labeling config, not free text
- Re-validate config-derived labels after any config edit
- Send the tag name attribute, never a label value, as control_tag
When it happens
Trigger: Calling rename_labels with request.data['control_tag'] absent or not present in the parsed config (e.g. 'label' when config uses 'choices'), or a tag from a previous config version.
Common situations: Config was edited/renamed so the control tag changed; passing the label name instead of the control tag name; extra whitespace/case mismatch; organizations renaming tags in Label Config XML without migrating annotations.
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/d7aeebdc579d7170.
Report an issue: GitHub.