HumanSignal/label-studio · error · ValidationError

"url" is not found in request data

Error message

"url" is not found in request data

What it means

When a sync import request uses content type application/x-www-form-urlencoded, Label Studio reads the tasks from the 'url' form field. If that field is missing or empty, load_tasks raises this ValidationError telling the caller that no URL was supplied in the form data.

Source

Thrown at label_studio/data_import/uploader.py:363

    could_be_tasks_list = False

    # take tasks from request FILES
    if len(request.FILES) > 0:
        check_request_files_size(request.FILES)
        check_extensions(request.FILES)
        for filename, file in request.FILES.items():
            file_upload = create_file_upload(request.user, project, file)
            if file_upload.format_could_be_tasks_list:
                could_be_tasks_list = True
            file_upload_ids.append(file_upload.id)
        tasks, found_formats, data_keys = FileUpload.load_tasks_from_uploaded_files(project, file_upload_ids)

    # take tasks from url address
    elif 'application/x-www-form-urlencoded' in request.content_type:
        # 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')

        # try to load json with task or tasks from url as string
        json_data = str_to_json(url)
        if json_data:
            file_upload = create_file_upload(request.user, project, SimpleUploadedFile('inplace.json', url.encode()))
            file_upload_ids.append(file_upload.id)
            tasks, found_formats, data_keys = FileUpload.load_tasks_from_uploaded_files(project, file_upload_ids)

        # download file using url and read tasks from it
        else:
            (
                data_keys,
                found_formats,
                tasks,
                file_upload_ids,
                could_be_tasks_list,

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Include a non-empty 'url' form field pointing to the task data
  2. If you meant to send tasks inline, switch Content-Type to application/json and send a JSON array
  3. URL-encode the form body properly (e.g. curl --data-urlencode "url=https://...")

Example fix

// before
curl -X POST $HOST/api/projects/1/import -H "Content-Type: application/x-www-form-urlencoded" -d ""
// after
curl -X POST $HOST/api/projects/1/import -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "url=https://example.com/tasks.json"
Defensive patterns

Strategy: validation

Validate before calling

form = {'url': task_data_url}
assert form['url'], "'url' form field is required for urlencoded imports"
requests.post(import_url, data=form)

Type guard

def has_url(form):
    return isinstance(form, dict) and bool(form.get('url'))

Try / catch

try:
    import_via_url(url)
except ValidationError as e:
    if '"url" is not found' in str(e):
        raise UserInputError('Include a non-empty url form field or switch to JSON-body import')
    raise

Prevention

When it happens

Trigger: POSTing to the import endpoint with Content-Type application/x-www-form-urlencoded but without a 'url' key in the body, or with url=''.

Common situations: Sending form-encoded data while intending JSON tasks; forgetting the url field; a proxy or client stripping empty form fields; curl -d without url=...

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29). Data as JSON: /api/errors/197b274e14b7c4bd. Report an issue: GitHub.