{"record":{"id":"a089dcd149522813","repo":"HumanSignal/label-studio","slug":"extract-message-e","errorCode":null,"errorMessage":"extract_message(e)","messagePattern":"extract_message\\(e\\)","errorType":"validation","errorClass":"ValidationError","httpStatus":400,"severity":"error","filePath":"label_studio/data_import/uploader.py","lineNumber":170,"sourceCode":"        if ext and ext.lower() not in settings.SUPPORTED_EXTENSIONS:\n            raise ValidationError(f'{ext} extension is not supported')\n\n        # Check file size before downloading\n        content_length = response.headers.get('content-length')\n        if content_length:\n            check_tasks_max_file_size(int(content_length))\n\n        file_content = response.content\n        file_upload = create_file_upload(user, project, SimpleUploadedFile(filename, file_content))\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    except ValidationError as e:\n        raise e\n    except Exception as e:\n        raise ValidationError(extract_message(e))\n    return data_keys, found_formats, tasks, file_upload_ids, could_be_tasks_list\n\n\n@timeit\ndef create_file_uploads(user, project, FILES):\n    could_be_tasks_list = False\n    file_upload_ids = []\n    check_request_files_size(FILES)\n    check_extensions(FILES)\n    for _, file in FILES.items():\n        file_upload = create_file_upload(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\n    logger.debug(f'created file uploads: {file_upload_ids} could_be_tasks_list: {could_be_tasks_list}')\n    return file_upload_ids, could_be_tasks_list\n","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_import/uploader.py#L152-L188","documentation":"ValidationError raised by tasks_from_url's catch-all handler in label_studio/data_import/uploader.py. Any non-ValidationError exception during URL download/parsing (network failures, HTTP errors, bad JSON, decompression issues) is caught, flattened with extract_message(e), and re-raised as a ValidationError. The original exception type and traceback are lost — the message text is the only diagnostic.","triggerScenarios":"tasks_from_url receiving a URL that fails to download (ConnectionError, Timeout, HTTPError from response.raise_for_status), a content-length that fails size check inside parsing, or load_tasks_from_uploaded_files choking on malformed content; all wrapped into ValidationError(extract_message(e)).","commonSituations":"Dead or unreachable URLs; presigned URLs expired (403); huge files timing out mid-download; URLs returning HTML error pages instead of data; proxy/firewall blocking outbound requests from the server.","solutions":["Read the raised message: it embeds the underlying error (HTTP status, connection message) and fix that root cause.","Verify the URL is reachable from the server (curl it on the Label Studio host), including auth/expiry for presigned URLs.","Download the file client-side, validate/convert it, and upload directly instead of passing a URL.","Increase timeouts / configure proxy env vars (HTTP_PROXY/HTTPS_PROXY) on the server if network egress is restricted."],"exampleFix":"// before\nurl = 'https://internal.example.com/data.json' // 404 -> wrapped ValidationError\n\n// after\ndownloadAndValidate(url); // fail fast client-side with real error\nuploadFile(convertedJson);","handlingStrategy":"try-catch","validationCode":"import requests\nresp = requests.head(url, allow_redirects=True, timeout=10)\nresp.raise_for_status()\ncl = resp.headers.get('content-length')\nif cl and int(cl) >= TASKS_MAX_FILE_SIZE:\n    raise ValueError('file too large for import')","typeGuard":null,"tryCatchPattern":"try:\n    import_from_url(url)\nexcept ValidationError as e:\n    msg = str(e)\n    if 'Max retries' in msg or 'timed out' in msg or 'Connection' in msg:\n        check_network_or_proxy(url); retry_with_backoff()\n    elif 'HTTPError' in msg or '404' in msg or '403' in msg:\n        fix_url_or_credentials(url)\n    else:\n        raise","preventionTips":["Pre-flight the URL with HEAD/GET from the same host running Label Studio.","Handle presigned URL expiry — generate fresh URLs right before import.","Configure HTTP_PROXY/HTTPS_PROXY on the server if egress is restricted.","Prefer downloading and validating data client-side over delegating fetch to the server."],"tags":["django","validation","network","error-wrapping","label-studio"],"backgroundTag":"wrapped-exception-validation-error","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}