HumanSignal/label-studio · error · ValidationError
Can't deserialize tasks due to {errors}
Error message
Can't deserialize tasks due to {errors} What it means
After validating every item, to_internal_value aggregates any per-item ValidationError messages (formatted as 'Error ... at item i: ... :: item', capped at 100) and raises this single DRF ValidationError carrying the list of errors. It is the terminal failure for a partially-invalid import batch — no tasks are created if any item fails.
Source
Thrown at label_studio/tasks/validation.py:247
except ValidationError as exc:
error = self.format_error(i, exc.detail, item)
errors.append(error)
# do not print to user too many errors
if len(errors) >= 100:
errors[99] = '...'
break
else:
ret.append(validated)
errors.append({})
if 'annotations' in item:
self.annotation_count += len(item['annotations'])
if 'predictions' in item:
self.prediction_count += len(item['predictions'])
if any(errors):
logger.warning("Can't deserialize tasks due to " + str(errors))
raise ValidationError(errors)
return ret
def is_url(string):
try:
result = urlparse(string.strip())
return all([result.scheme, result.netloc])
except ValueError:
return False
View on GitHub (pinned to 0b49e9b539)
Solutions
- Read the errors list in the response: each entry names the item index and the exact problem
- Fix the offending items (typically missing/wrong-typed keys under 'data') and re-import the full batch
- Compare your data keys against the project's labeling config (project.data_types) — every required data key must exist with an allowed type
- Pre-validate locally by replicating the checks: dict root, 'data' present, expected types per config
- Import in smaller chunks to isolate which items are invalid
Example fix
// before
[{"text": "missing data wrapper"}]
// after
[{"data": {"text": "wrapped under data"}}] Defensive patterns
Strategy: validation
Validate before calling
for i, task in enumerate(tasks):
assert isinstance(task, dict), f'item {i} not a dict'
assert 'data' in task, f'item {i} missing data'
for key in required_data_keys: # from project.data_types
assert key in task['data'], f'item {i} missing data key {key}' Try / catch
try:
client.import_tasks(id=project_id, tasks=tasks)
except LabelStudioError as e:
for err in getattr(e, 'detail', [str(e)]):
print(err) # each names item index and the exact problem
raise Prevention
- Parse the per-item error strings in the response — they include the item index
- Cross-check data keys against the project's labeling config before import
- Import in chunks to isolate failing items
- Keep a schema test for your export-to-Label-Studio converter
When it happens
Trigger: Any batch where at least one item fails TaskValidator.validate — missing 'data' key, wrong data types vs the labeling config, bad annotation/prediction structure, non-dict task root, etc.
Common situations: Bulk imports mixing valid and invalid rows from a CSV/JSON conversion; items that reference data keys absent from the project's labeling config; imports built from other tools' export formats that don't match Label Studio's task schema.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Annotation must have "result" fields
- Prediction must have "result" fields
- All tasks are empty (None)
- data is not a list
- data is empty
AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29).
Data as JSON: /api/errors/4942a5074a1a78c1.
Report an issue: GitHub.