HumanSignal/label-studio · error · ValidationError
Label config contains non-unique names:
Error message
Label config contains non-unique names:
What it means
Label config tag names (name="...") must be unique. After schema validation, validate_label_config collects all name="..." values via regex and raises this ValidationError if the set of names is smaller than the list (duplicates exist). Note the FIXME: names written with spaces like 'name =' are not matched.
Source
Thrown at label_studio/core/label_config.py:127
try:
config, cleaned_config_string = parse_config_to_json(config_string)
jsonschema.validate(config, _LABEL_CONFIG_SCHEMA_DATA)
except (etree.ParseError, ValueError) as exc:
raise ValidationError(str(exc))
except jsonschema.exceptions.ValidationError as exc:
# jsonschema4 validation error now includes all errors from "anyOf" subschemas
# check https://python-jsonschema.readthedocs.io/en/latest/errors/#jsonschema.exceptions.ValidationError.context
# we pick the first failed schema and show only its error message
error_message = exc.context[0].message if len(exc.context) else exc.message
error_message = 'Validation failed on {}: {}'.format(
'/'.join(map(str, exc.path)), error_message.replace('@', '')
)
raise ValidationError(error_message)
# unique names in config # FIXME: 'name =' (with spaces) won't work
all_names = re.findall(r'(?:^|[^\w])name="([^"]*)"', cleaned_config_string)
if len(set(all_names)) != len(all_names):
raise ValidationError('Label config contains non-unique names: ' + ', '.join(all_names))
# toName points to existent name
names = set(all_names)
toNames = re.findall(r'toName="([^"]*)"', cleaned_config_string)
for toName_ in toNames:
for toName in toName_.split(','):
if toName not in names:
raise ValidationError(f'toName="{toName}" not found in names: {sorted(names)}')
# Tag attribute validation (e.g. Video playback speed) via SDK
try:
li = LabelInterface(config_string)
if hasattr(li, '_tag_attribute_validation'):
li._tag_attribute_validation()
except LabelStudioValidationErrorSentryIgnored as exc:
raise ValidationError(str(exc))
View on GitHub (pinned to 0b49e9b539)
Solutions
- Find duplicate names in your config (search name=" occurrences) and rename all but one uniquely.
- Use descriptive unique names per tag, e.g. name="text1", name="text2".
- Remember to update corresponding toName="..." references after renaming.
- Note: 'name =' with spaces before '=' isn't detected by this check — keep attribute syntax as name="value".
Example fix
<!-- before --> <Text name="text" value="$article"/> <Text name="text" value="$summary"/> <!-- after --> <Text name="article" value="$article"/> <Text name="summary" value="$summary"/>
Defensive patterns
Strategy: validation
Validate before calling
import re
defens_names = re.findall(r'(?:^|[^\w])name="([^"]*)"', config)
dups = {n for n in defens_names if defens_names.count(n) > 1}
if dups:
raise ValueError(f'Duplicate tag names: {dups}') Try / catch
try:
validate_label_config(config)
except ValidationError as e:
if 'non-unique names' in str(e):
return Response({'error': str(e), 'hint': 'Rename duplicate tag name attributes'}, status=400)
raise Prevention
- Keep a naming convention per tag type (e.g. choices1, choices2).
- Search the config for name=" before submitting and eyeball for repeats.
- When copying tag blocks, rename the copy immediately.
- Automate a duplicate-name check in your config linting.
When it happens
Trigger: A label config containing two or more tags with the same name="..." value, passed to validate_label_config (e.g. saving project labeling config via API or UI).
Common situations: Duplicating a tag block (e.g. two <Text name="text"> or two <Choices name="sentiment">) when composing complex configs; merging configs from templates without renaming.
Related errors
- toName="{toName}" not found in names: {sorted(names)}
- Validation failed on {}: {}
- Your label config has more than one data key and direct file
- {'predictions': prediction_errors}
- "{data_key}" key is expected in task data
AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29).
Data as JSON: /api/errors/f5b7dced6fddcec6.
Report an issue: GitHub.