{"record":{"id":"ea1fe0a86ec93083","repo":"hiyouga/LlamaFactory","slug":"no-json-jsonl-files-found-in-the-specified-path","errorCode":null,"errorMessage":"No JSON/JSONL files found in the specified path: {cloud_path}.","messagePattern":"No JSON/JSONL files found in the specified path: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/data/data_utils.py","lineNumber":201,"sourceCode":"def read_cloud_json(cloud_path: str) -> list[Any]:\n    r\"\"\"Read a JSON/JSONL file from cloud storage (S3 or GCS).\n\n    Args:\n        cloud_path: str\n            Cloud path in the format:\n            - 's3://bucket-name/file.json' for AWS S3\n            - 'gs://bucket-name/file.jsonl' or 'gcs://bucket-name/file.jsonl' for Google Cloud Storage\n    \"\"\"\n    try:\n        fs = setup_fs(cloud_path, anon=True)  # try with anonymous access first\n    except Exception:\n        fs = setup_fs(cloud_path)  # try again with credentials\n\n    # filter out non-JSON files\n    files = [x[\"Key\"] for x in fs.listdir(cloud_path)] if fs.isdir(cloud_path) else [cloud_path]\n    files = list(filter(lambda file: file.endswith(\".json\") or file.endswith(\".jsonl\"), files))\n    if not files:\n        raise ValueError(f\"No JSON/JSONL files found in the specified path: {cloud_path}.\")\n\n    return sum([_read_json_with_fs(fs, file) for file in files], [])\n","sourceCodeStart":183,"sourceCodeEnd":204,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/data/data_utils.py#L183-L204","documentation":"The cloud JSON loader lists the path (if it is a directory) or uses it directly, filters entries to .json/.jsonl suffixes, and raises ValueError when nothing survives the filter. Data files with other extensions (e.g. .json.gz, .parquet, .txt) or a directory containing only those are rejected.","triggerScenarios":"Passing a cloud directory containing parquet/csv/arrow files; file named data.JSON (uppercase) or data.json.gz; pointing at a prefix whose JSON files live one level deeper (listing is not recursive by default in this helper).","commonSituations":"Converting a HF dataset hosted as parquet on S3/GCS and assuming the cloud loader handles it; nested folder layouts like s3://bucket/data/train/*.json where the prefix given is s3://bucket/data.","solutions":["Ensure the target contains files ending exactly in .json or .jsonl (lowercase).","Point the path directly at the file: s3://bucket/data/train/data.jsonl instead of a parent directory.","Convert parquet/other formats to json/jsonl before uploading, or load them locally via dataset_info's常规 columns.","Flatten nested directories so the JSON files sit at the listed prefix."],"exampleFix":"# before\n{\"file_name\": \"s3://my-bucket/data\"}  # dir holds parquet files\n\n# after\n# convert to jsonl, upload, then\n{\"file_name\": \"s3://my-bucket/data/train.jsonl\"}","handlingStrategy":"validation","validationCode":"fs = fsspec.filesystem(\"s3\")\nfiles = [x[\"Key\"] for x in fs.listdir(cloud_path)] if fs.isdir(cloud_path) else [cloud_path]\njson_files = [f for f in files if f.endswith((\".json\", \".jsonl\"))]\nassert json_files, \"no .json/.jsonl files at path — convert or point directly at a file\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize cloud-hosted datasets to jsonl.","Point at the exact file rather than a directory when possible.","Watch out for nested prefixes and non-lowercase extensions."],"tags":["cloud-storage","dataset","file-format","fsspec"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}