{"record":{"id":"a318ba2725b0e964","repo":"HumanSignal/label-studio","slug":"url-must-be-2048-characters-or-fewer-a318ba","errorCode":null,"errorMessage":"\"url\" must be 2048 characters or fewer","messagePattern":"\"url\" must be 2048 characters or fewer","errorType":"validation","errorClass":"ValidationError","httpStatus":400,"severity":"error","filePath":"label_studio/data_import/uploader.py","lineNumber":365,"sourceCode":"    # take tasks from request FILES\n    if len(request.FILES) > 0:\n        check_request_files_size(request.FILES)\n        check_extensions(request.FILES)\n        for filename, file in request.FILES.items():\n            file_upload = create_file_upload(request.user, project, file)\n            if file_upload.format_could_be_tasks_list:\n                could_be_tasks_list = True\n            file_upload_ids.append(file_upload.id)\n        tasks, found_formats, data_keys = FileUpload.load_tasks_from_uploaded_files(project, file_upload_ids)\n\n    # take tasks from url address\n    elif 'application/x-www-form-urlencoded' in request.content_type:\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\n        # try to load json with task or tasks from url as string\n        json_data = str_to_json(url)\n        if json_data:\n            file_upload = create_file_upload(request.user, project, SimpleUploadedFile('inplace.json', url.encode()))\n            file_upload_ids.append(file_upload.id)\n            tasks, found_formats, data_keys = FileUpload.load_tasks_from_uploaded_files(project, file_upload_ids)\n\n        # download file using url and read tasks from it\n        else:\n            (\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","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_import/uploader.py#L347-L383","documentation":"Label Studio limits the 'url' form field on urlencoded sync imports to 2048 characters. If a longer string is supplied, load_tasks raises this ValidationError before attempting to fetch or parse it, protecting against abuse of the url field as an inline data channel.","triggerScenarios":"POSTing application/x-www-form-urlencoded data with a 'url' field longer than 2048 chars — typically someone pasting large JSON task data directly into the url field instead of giving a real URL.","commonSituations":"Inlining JSON payloads in url=... (they parse via str_to_json but oversize ones are rejected); URLs with very long query strings or embedded tokens; generated pre-signed URLs exceeding the limit.","solutions":["Host the task data at a real URL and pass that (short) URL instead of inlining the data","Use the file-upload or JSON-body import path for large payloads","Shorten the URL (remove query params, use a URL shortener) if it is genuinely a URL"],"exampleFix":"// before\nrequests.post(url, data={\"url\": \"[{\" + huge_tasks_json + \"}]\"})\n// after\nrequests.post(url, json=huge_tasks_list)  # or upload via files=","handlingStrategy":"validation","validationCode":"if url and len(url) > 2048:\n    raise ValueError('url exceeds the 2048 character limit; host data at a real URL instead')","typeGuard":"def is_valid_import_url(url):\n    return isinstance(url, str) and 0 < len(url) <= 2048 and url.startswith(('http://', 'https://'))","tryCatchPattern":"try:\n    import_via_url(url)\nexcept ValidationError as e:\n    if '2048 characters' in str(e):\n        import_via_file_upload(upload_bytes(url.encode()))  # fallback path\n    else:\n        raise","preventionTips":["Never inline raw JSON data in the url field; use real URLs or file upload","Strip unnecessary query parameters from long URLs","Check URL length before posting"],"tags":["validation","limits","url","label-studio"],"backgroundTag":"payload-size-limit-exceeded","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}