zed-industries/zed · error

invalid split point kind '{value}' (expected fim, same-file-

Error message

invalid split point kind '{value}' (expected fim, same-file-near, same-file-far, or cross-file)

What it means

Thrown by the FromStr implementation for SplitPointKind when parsing the kind keyword of the `--split-point`/`-s` argument to `ep split-commit`. Only four kind spellings are accepted — `fim`, `same-file-near`, `same-file-far`, `cross-file` — in exact kebab-case. Note the same flag also accepts fractions (0.0-1.0) and integer indexes, which are parsed before the kind keyword is attempted.

Source

Thrown at crates/edit_prediction_cli/src/split_commit.rs:149

        match self {
            SplitPointKind::Fim => write!(f, "fim"),
            SplitPointKind::SameFileNear => write!(f, "same-file-near"),
            SplitPointKind::SameFileFar => write!(f, "same-file-far"),
            SplitPointKind::CrossFile => write!(f, "cross-file"),
        }
    }
}

impl std::str::FromStr for SplitPointKind {
    type Err = anyhow::Error;

    fn from_str(value: &str) -> Result<Self> {
        match value {
            "fim" => Ok(Self::Fim),
            "same-file-near" => Ok(Self::SameFileNear),
            "same-file-far" => Ok(Self::SameFileFar),
            "cross-file" => Ok(Self::CrossFile),
            _ => anyhow::bail!(
                "invalid split point kind '{value}' (expected fim, same-file-near, same-file-far, or cross-file)"
            ),
        }
    }
}

#[derive(Debug, Clone, PartialEq)]
pub enum SplitPoint {
    /// Fraction of total edits (0.0 to 1.0)
    Fraction(f64),
    /// Absolute index
    Index(usize),
    /// Random split point matching the requested kind.
    Kind(SplitPointKind),
    /// Explicit split point that must match the requested kind.
    KindWithSplit {
        kind: SplitPointKind,
        split_point: SplitPointValue,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Use one of the exact values: fim, same-file-near, same-file-far, cross-file
  2. Check `ep split-commit --help` for the accepted syntax (fraction, index, or kind keyword)
  3. If you meant a specific position, pass a fraction like 0.5 or an integer index instead of a kind name

Example fix

# before
ep split-commit -s same_file_near input.jsonl

# after
ep split-commit -s same-file-near input.jsonl
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_split_point_kind(value: &str) -> bool {
    matches!(value, "fim" | "same-file-near" | "same-file-far" | "cross-file")
}

Type guard

fn is_valid_split_point_kind(value: &str) -> bool {
    matches!(value, "fim" | "same-file-near" | "same-file-far" | "cross-file")
}

Try / catch

When driving the CLI from code, validate the argument first and fail with the accepted-value list before spawning the process.

Prevention

When it happens

Trigger: Passing `--split-point same_file_near` (underscores), `--split-point SameFileNear` (wrong case), or any other misspelling that is neither a number, fraction, nor one of the four kebab-case kinds.

Common situations: Copying Rust enum variant names instead of the CLI spellings; underscore/hyphen confusion; typos in automation scripts.

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/932ca22fdfd65007. Report an issue: GitHub.