Resolving CSV Import Parsing Errors in Label Studio


Sometimes while attempting to import a CSV file into Label Studio as a series of tasks, the following parsing error is encountered:

Error at item 0: "image_url" key is expected in task data [assume: item["data"] = task root with values] :: {'data': {'uid': 1, ' image_url': 'https://...jpg'}, 'file_upload_id': 8}


The error suggests that there is an unexpected space before the “image_url” key in the imported CSV file. Correcting the CSV structure should resolve the parsing error.

  1. Edit the CSV: Open your CSV file and ensure there are no leading spaces in the column headers or values. The corrected CSV file should have headers like this, without any spaces around the commas:
  1. CSV Format: Confirm the CSV’s general formatting; it should be comma-delimited and have no extraneous spaces.
  2. Re-import the CSV: With the corrected file, import the CSV into Label Studio again, choosing the option “Treat CSV/TSV as: List of tasks” so each row is treated as an individual task.
  3. Check Tasks: After successful import, validate that the tasks appear as expected with the “image_url” field properly recognized for the labeling interface.