zed-industries/zed · error

--in-place requires exactly one input file

Error message

--in-place requires exactly one input file

What it means

EpArgs::output_path resolves where results are written. With `--in-place`, the tool writes back into the single input file, so `self.inputs` must contain exactly one path; zero or multiple inputs panic immediately with '--in-place requires exactly one input file'. This is a CLI argument consistency check.

Source

Thrown at crates/edit_prediction_cli/src/main.rs:654

    #[test]
    fn prediction_provider_jumps_non_batched_alias_round_trips_to_primary_spelling() {
        let provider: PredictionProvider = "teacher_jumps_non_batching:gpt52".parse().unwrap();
        assert_eq!(
            provider,
            PredictionProvider::TeacherJumpsNonBatching(TeacherBackend::Gpt52)
        );
        assert_eq!(provider.to_string(), "teacher-jumps-non-batching:gpt52");
    }
}

impl EpArgs {
    fn output_path(&self) -> Option<PathBuf> {
        if self.in_place {
            if self.inputs.len() == 1 {
                self.inputs.first().cloned()
            } else {
                panic!("--in-place requires exactly one input file")
            }
        } else {
            self.output.clone()
        }
    }
}

/// Minimum Zed version required for Snowflake queries.
/// This version introduced the current request schema with predicted edits in the edit
/// history, and open source repos distinguished.
const MIN_CAPTURE_VERSION: pull_examples::MinCaptureVersion = pull_examples::MinCaptureVersion {
    major: 0,
    minor: 224,
    patch: 1,
};

fn deduplicate_examples(examples: &mut Vec<Example>, max_per_cluster: usize) {
    let total_before_exact = examples.len();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Pass exactly one input file when using --in-place
  2. Or drop --in-place and write to an explicit path with --output
  3. For multiple files, invoke the command once per file (or in a loop) with --in-place

Example fix

# before
edit-prediction-cli run --in-place --inputs a.jsonl b.jsonl  # panic

# after
edit-prediction-cli run --in-place --inputs a.jsonl
edit-prediction-cli run --in-place --inputs b.jsonl
Defensive patterns

Strategy: validation

Validate before calling

if args.in_place {
    anyhow::ensure!(
        args.inputs.len() == 1,
        "--in-place requires exactly one input file (got {})",
        args.inputs.len()
    );
}

Prevention

When it happens

Trigger: Invoking the CLI with `--in-place` but no input file, or with two or more input files/directories (e.g. `--in-place --inputs a.jsonl b.jsonl`).

Common situations: Scripts that loop over several files pass them all at once while keeping `--in-place`; a flag combination copied from a batch invocation.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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