zed-industries/zed · error

{} has invalid example extension `{ext}`

Error message

{} has invalid example extension `{ext}`

What it means

The edit_prediction_cli example loader (parse_example_files) dispatches on each input file's extension and only accepts `json`, `jsonl`, and `md`. Any other extension falls into the catch-all arm and panics with the offending path, aborting the whole run. This is a strict input-format contract for evaluation example files.

Source

Thrown at crates/edit_prediction_cli/src/example.rs:278

                                    line_ix + 1
                                )
                            });
                        if example.spec.name.is_empty() {
                            example.spec.name = format!("{filename}-{line_ix}")
                        }
                        example
                    })
                    .collect::<Vec<Example>>(),
            ),
            "md" => {
                let mut example = parse_markdown_example(&content).unwrap();
                if example.spec.name.is_empty() {
                    example.spec.name = filename;
                }
                examples.push(example);
            }
            ext => {
                panic!("{} has invalid example extension `{ext}`", path.display())
            }
        }
    }

    examples
}

pub fn sort_examples_by_repo_and_rev(examples: &mut [Example]) {
    examples.sort_by(|a, b| {
        a.spec
            .repository_url
            .cmp(&b.spec.repository_url)
            .then(b.spec.revision.cmp(&a.spec.revision))
    });
}

pub fn group_examples_by_repo(examples: Vec<Example>) -> VecDeque<Vec<Example>> {
    let mut examples_by_repo: HashMap<String, Vec<Example>> = HashMap::default();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Remove or move files whose extension is not json, jsonl, or md out of the input directory
  2. Rename the file to match its actual content: .json (single Example), .jsonl (one Example per line), or .md (markdown example)
  3. If a new format is genuinely required, add a match arm in parse_example_files (crates/edit_prediction_cli/src/example.rs:239) that parses it

Example fix

# before
inputs/my_example.yaml   <-- panic: invalid example extension `yaml`

# after
mv inputs/my_example.yaml inputs/my_example.json
Defensive patterns

Strategy: validation

Validate before calling

let ok = inputs.iter().all(|p| {
    matches!(
        p.extension().and_then(|e| e.to_str()),
        Some("json") | Some("jsonl") | Some("md")
    )
});
assert!(ok, "input contains unsupported extensions");

Type guard

fn is_supported_example_ext(ext: &str) -> bool {
    matches!(ext, "json" | "jsonl" | "md")
}

Prevention

When it happens

Trigger: Pointing `--inputs` (or the example-parsing commands) at a directory or file whose extension is not json/jsonl/md, e.g. `examples.json.bak`, `notes.txt`, `.DS_Store`, editor swap files, or a directory containing stray non-example files.

Common situations: Example directories polluted by editor backups, OS metadata files, README notes, or a renamed export; someone adds a `.yaml` example file assuming the tool supports it.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/403048ebbcc384e8. Report an issue: GitHub.