{"record":{"id":"153be5c60f08cc1f","repo":"zed-industries/zed","slug":"failed-to-parse-example-on-error","errorCode":null,"errorMessage":"Failed to parse example on {}:{}\n{error}","messagePattern":"Failed to parse example on (.+?):(.+?)\n(.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/example.rs","lineNumber":257,"sourceCode":"        match ext.as_ref() {\n            \"json\" => {\n                let mut example =\n                    serde_json::from_str::<Example>(&content).unwrap_or_else(|error| {\n                        panic!(\"Failed to parse example file: {}\\n{error}\", path.display())\n                    });\n                if example.spec.name.is_empty() {\n                    example.spec.name = filename;\n                }\n                examples.push(example);\n            }\n            \"jsonl\" => examples.extend(\n                content\n                    .lines()\n                    .enumerate()\n                    .map(|(line_ix, line)| {\n                        let mut example =\n                            serde_json::from_str::<Example>(line).unwrap_or_else(|error| {\n                                panic!(\n                                    \"Failed to parse example on {}:{}\\n{error}\",\n                                    path.display(),\n                                    line_ix + 1\n                                )\n                            });\n                        if example.spec.name.is_empty() {\n                            example.spec.name = format!(\"{filename}-{line_ix}\")\n                        }\n                        example\n                    })\n                    .collect::<Vec<Example>>(),\n            ),\n            \"md\" => {\n                let mut example = parse_markdown_example(&content).unwrap();\n                if example.spec.name.is_empty() {\n                    example.spec.name = filename;\n                }\n                examples.push(example);","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/example.rs#L239-L275","documentation":"For .jsonl inputs every line must be a complete Example object. The loader enumerates lines and, on the first that fails serde parsing, panics with the file, the 1-based line number, and the serde error. Blank lines fail too, since every line is passed to from_str unchanged.","triggerScenarios":"A blank line inside the file; a truncated final line from an interrupted write; one record missing required fields; pretty-printed multi-line JSON saved with a .jsonl extension.","commonSituations":"Appending records with stray trailing newlines; partially downloaded datasets; hand-merging files with different schemas; editors auto-adding a final newline creating an empty record expectation.","solutions":["Go to the exact file:line from the panic and fix or delete that record","Strip blank lines: grep -v '^$' in.jsonl > clean.jsonl","Find all bad lines at once: jq -c '.' < in.jsonl > /dev/null — it reports each failing line number","Regenerate the JSONL from its source instead of hand-editing"],"exampleFix":"# before — examples.jsonl contains a blank line\n# panic: Failed to parse example on examples.jsonl:2\n\n# after\ngrep -v '^$' examples.jsonl > examples.clean.jsonl\nedit-prediction-cli eval examples.clean.jsonl","handlingStrategy":"validation","validationCode":"bad_lines = [\n    ix + 1\n    for ix, line in enumerate(content.splitlines())\n    if not line.strip() or serde_json::from_str::<Example>(line).is_err()\n]\nassert not bad_lines, f\"unparseable lines: {bad_lines}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip blank lines when generating or concatenating JSONL files","Validate every line with a serde or jq pass before feeding the CLI","Treat a truncated final line as a sign of an interrupted write — regenerate the file"],"tags":["jsonl","serde","parsing","panic","edit-prediction"],"backgroundTag":"jsonl-parse-error","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}