{"record":{"id":"416909df9fda5475","repo":"HumanSignal/label-studio","slug":"load-tasks-no-data-found-in-data-or-in-files-416909","errorCode":null,"errorMessage":"load_tasks: No data found in DATA or in FILES","messagePattern":"load_tasks: No data found in DATA or in FILES","errorType":"validation","errorClass":"ValidationError","httpStatus":400,"severity":"error","filePath":"label_studio/data_import/uploader.py","lineNumber":394,"sourceCode":"            (\n                data_keys,\n                found_formats,\n                tasks,\n                file_upload_ids,\n                could_be_tasks_list,\n            ) = tasks_from_url(file_upload_ids, project, request.user, url, could_be_tasks_list)\n\n    # take one task from request DATA\n    elif 'application/json' in request.content_type and isinstance(request.data, dict):\n        tasks = [request.data]\n\n    # take many tasks from request DATA\n    elif 'application/json' in request.content_type and isinstance(request.data, list):\n        tasks = request.data\n\n    # incorrect data source\n    else:\n        raise ValidationError('load_tasks: No data found in DATA or in FILES')\n\n    # check is data root is list\n    if not isinstance(tasks, list):\n        raise ValidationError('load_tasks: Data root must be list')\n\n    # empty tasks error\n    if not tasks:\n        raise ValidationError('load_tasks: No tasks added')\n\n    check_max_task_number(tasks)\n    return tasks, file_upload_ids, could_be_tasks_list, found_formats, list(data_keys)\n","sourceCodeStart":376,"sourceCodeEnd":406,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_import/uploader.py#L376-L406","documentation":"load_tasks reached the end of its content-type dispatch without finding a supported data source: the request was not multipart file upload, not a urlencoded request with a url, and not an application/json request whose body is a list. It raises this ValidationError indicating no task data could be located in request DATA or FILES.","triggerScenarios":"Sending the import request with an unsupported Content-Type (e.g. text/plain, application/json with a non-list body such as an object or string), or an empty body.","commonSituations":"Posting a JSON object instead of a JSON array; missing Content-Type header so Django can't parse data; clients sending XML or plain text; SDK misuse passing a dict to a function that expects a list.","solutions":["Send the tasks as a JSON array with Content-Type: application/json","Or upload files via multipart/form-data, or provide a 'url' form field with urlencoded content type","Verify the Content-Type header matches the actual body format"],"exampleFix":"// before\nrequests.post(import_url, json={\"data\": [{\"text\": \"x\"}]})  # object root\n// after\nrequests.post(import_url, json=[{\"data\": {\"text\": \"x\"}}])  # list root, application/json","handlingStrategy":"validation","validationCode":"def validate_import_request(body, content_type):\n    if 'application/json' in content_type and not isinstance(body, list):\n        raise ValueError('JSON import body must be a list of tasks')\n    if not body:\n        raise ValueError('Import body is empty')","typeGuard":"def is_list_body(content_type, body):\n    return 'application/json' in content_type and isinstance(body, list)","tryCatchPattern":"try:\n    import_tasks(body)\nexcept ValidationError as e:\n    if 'No data found in DATA or in FILES' in str(e):\n        raise UserInputError('Send a JSON array body, multipart files, or urlencoded url')\n    raise","preventionTips":["Set Content-Type: application/json and send an array for inline imports","Use multipart/form-data for file uploads","Confirm proxies don't strip or rewrite the Content-Type header"],"tags":["validation","content-type","http","label-studio"],"backgroundTag":"unsupported-content-type","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}