HumanSignal/label-studio · error · ValidationError
"url" is not found in request data
Error message
"url" is not found in request data
What it means
async_import handles imports sent as application/x-www-form-urlencoded. In that branch it reads request.data['url'] to import from a remote URL, and raises this ValidationError if the 'url' key is absent or empty. The content type signaled 'url import' but the required field is missing.
Source
Thrown at label_studio/data_import/api.py:392
project_import = ProjectImport.objects.create(
project=project,
preannotated_from_fields=preannotated_from_fields,
commit_to_project=commit_to_project,
return_task_ids=return_task_ids,
)
if len(request.FILES) > 0:
logger.debug(f'Import from files: {request.FILES}')
file_upload_ids, could_be_tasks_list = create_file_uploads(request.user, project, request.FILES)
project_import.file_upload_ids = file_upload_ids
project_import.could_be_tasks_list = could_be_tasks_list
project_import.save(update_fields=['file_upload_ids', 'could_be_tasks_list'])
elif 'application/x-www-form-urlencoded' in request.content_type:
logger.debug(f'Import from url: {request.data.get("url")}')
# empty url
url = request.data.get('url')
if not url:
raise ValidationError('"url" is not found in request data')
if len(url) > 2048:
raise ValidationError('"url" must be 2048 characters or fewer')
project_import.url = url
project_import.save(update_fields=['url'])
# take one task from request DATA
elif 'application/json' in request.content_type and isinstance(request.data, dict):
project_import.tasks = [request.data]
project_import.save(update_fields=['tasks'])
# take many tasks from request DATA
elif 'application/json' in request.content_type and isinstance(request.data, list):
project_import.tasks = request.data
project_import.save(update_fields=['tasks'])
# incorrect data source
else:
raise ValidationError('load_tasks: No data found in DATA or in FILES')
View on GitHub (pinned to 0b49e9b539)
Solutions
- Add a non-empty 'url' field to the form-encoded body of the import request
- Verify the Content-Type: if you meant a JSON/file upload import, use application/json or multipart/form-data instead of urlencoded
- Check the client code/CI variable that populates the url value is not empty at request time
- Ensure the url is URL-encoded in the form body
Example fix
# before curl -X POST "$LS/api/projects/1/import" -H "Authorization: Token $T" -d "name=import1" # after curl -X POST "$LS/api/projects/1/import" -H "Authorization: Token $T" -d "url=https://example.com/tasks.json"
Defensive patterns
Strategy: validation
Validate before calling
url = form_data.get('url')
if not url:
raise ValueError('form body must include a non-empty "url" field') Type guard
def has_url(payload: dict) -> bool:
return isinstance(payload.get('url'), str) and len(payload['url']) > 0 Try / catch
try:
requests.post(import_url, headers=H, data=form_data).raise_for_status()
except requests.HTTPError as e:
if 'url" is not found' in e.response.text:
raise SystemExit('Add a non-empty "url" form field or switch to JSON/file import') Prevention
- Assert the url variable is populated before building the request in CI scripts
- Never send urlencoded bodies without the url key; pick the content type matching your import mode
- URL-encode the url value
When it happens
Trigger: POST /api/projects/{id}/import (async) with Content-Type application/x-www-form-urlencoded and either no 'url' form field or url=''. Any other form fields present do not substitute for 'url'.
Common situations: Client code switching to form-encoded body but forgetting the url field; curl -d flags that send a different key name (e.g. file_url); empty url after variable interpolation in CI scripts; proxy or client library dropping empty form fields.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- "url" must be 2048 characters or fewer
- Prediction validation failed ({len(validation_errors)} error
- load_tasks: No data found in DATA or in FILES
- preannotated_fields
- Can't deserialize tasks due to {errors}
AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29).
Data as JSON: /api/errors/e8e580949ff62114.
Report an issue: GitHub.