{"record":{"id":"e8e580949ff62114","repo":"HumanSignal/label-studio","slug":"url-is-not-found-in-request-data","errorCode":null,"errorMessage":"\"url\" is not found in request data","messagePattern":"\"url\" is not found in request data","errorType":"validation","errorClass":"ValidationError","httpStatus":400,"severity":"error","filePath":"label_studio/data_import/api.py","lineNumber":392,"sourceCode":"        project_import = ProjectImport.objects.create(\n            project=project,\n            preannotated_from_fields=preannotated_from_fields,\n            commit_to_project=commit_to_project,\n            return_task_ids=return_task_ids,\n        )\n\n        if len(request.FILES) > 0:\n            logger.debug(f'Import from files: {request.FILES}')\n            file_upload_ids, could_be_tasks_list = create_file_uploads(request.user, project, request.FILES)\n            project_import.file_upload_ids = file_upload_ids\n            project_import.could_be_tasks_list = could_be_tasks_list\n            project_import.save(update_fields=['file_upload_ids', 'could_be_tasks_list'])\n        elif 'application/x-www-form-urlencoded' in request.content_type:\n            logger.debug(f'Import from url: {request.data.get(\"url\")}')\n            # empty url\n            url = request.data.get('url')\n            if not url:\n                raise ValidationError('\"url\" is not found in request data')\n            if len(url) > 2048:\n                raise ValidationError('\"url\" must be 2048 characters or fewer')\n            project_import.url = url\n            project_import.save(update_fields=['url'])\n        # take one task from request DATA\n        elif 'application/json' in request.content_type and isinstance(request.data, dict):\n            project_import.tasks = [request.data]\n            project_import.save(update_fields=['tasks'])\n\n        # take many tasks from request DATA\n        elif 'application/json' in request.content_type and isinstance(request.data, list):\n            project_import.tasks = request.data\n            project_import.save(update_fields=['tasks'])\n\n        # incorrect data source\n        else:\n            raise ValidationError('load_tasks: No data found in DATA or in FILES')\n","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_import/api.py#L374-L410","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"# before\ncurl -X POST \"$LS/api/projects/1/import\" -H \"Authorization: Token $T\" -d \"name=import1\"\n# after\ncurl -X POST \"$LS/api/projects/1/import\" -H \"Authorization: Token $T\" -d \"url=https://example.com/tasks.json\"","handlingStrategy":"validation","validationCode":"url = form_data.get('url')\nif not url:\n    raise ValueError('form body must include a non-empty \"url\" field')","typeGuard":"def has_url(payload: dict) -> bool:\n    return isinstance(payload.get('url'), str) and len(payload['url']) > 0","tryCatchPattern":"try:\n    requests.post(import_url, headers=H, data=form_data).raise_for_status()\nexcept requests.HTTPError as e:\n    if 'url\" is not found' in e.response.text:\n        raise SystemExit('Add a non-empty \"url\" form field or switch to JSON/file import')","preventionTips":["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"],"tags":["django","rest-framework","import","url","request-validation"],"backgroundTag":"missing-required-field","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}