zed-industries/zed · error
only one split can use 'rest'
Error message
only one split can use 'rest'
What it means
Bailed while computing split sizes for `ep split`: more than one split spec used the `=rest` size. `rest` means 'whatever remains after all other splits are satisfied', which is only well-defined for a single split, so a second occurrence is rejected before any lines are distributed.
Source
Thrown at crates/edit_prediction_cli/src/split_dataset.rs:187
fn compute_split_counts(specs: &[SplitSpec], total: usize) -> Result<Vec<usize>> {
let mut counts = vec![0usize; specs.len()];
let mut remaining = total;
let mut rest_index: Option<usize> = None;
for (i, spec) in specs.iter().enumerate() {
match &spec.size {
SplitSize::Percentage(pct) => {
let count = (total as f64 * pct).round() as usize;
counts[i] = count.min(remaining);
remaining = remaining.saturating_sub(counts[i]);
}
SplitSize::Absolute(count) => {
counts[i] = (*count).min(remaining);
remaining = remaining.saturating_sub(counts[i]);
}
SplitSize::Rest => {
if rest_index.is_some() {
bail!("only one split can use 'rest'");
}
rest_index = Some(i);
}
}
}
if let Some(idx) = rest_index {
counts[idx] = remaining;
}
Ok(counts)
}
fn write_lines_to_file(path: &Path, lines: &[String]) -> Result<()> {
if let Some(parent) = path.parent() {
if !parent.as_os_str().is_empty() {
std::fs::create_dir_all(parent)
.with_context(|| format!("failed to create directory '{}'", parent.display()))?;View on GitHub (pinned to f4178619ac)
Solutions
- Give all but one split an explicit percentage or absolute count
- Keep `=rest` on the single split that should absorb leftovers
Example fix
# before ep split data.jsonl train.jsonl=80% dev.jsonl=rest test.jsonl=rest # after ep split data.jsonl train.jsonl=80% dev.jsonl=10% test.jsonl=rest
Defensive patterns
Strategy: validation
Validate before calling
let rest_count = specs.iter().filter(|s| s.ends_with("=rest")).count();
if rest_count > 1 {
// reject before running: only one split may claim the remainder
} Try / catch
Count `=rest` occurrences across the spec list up front and fail with a clear message naming the duplicate splits.
Prevention
- Audit spec lists for duplicate rest before launching split
- Convert extra rest specs to explicit percentages or counts when adding splits
- Encode the invariant 'at most one rest' in whatever generates the command line
When it happens
Trigger: Running `ep split data.jsonl train.jsonl=80% valid.jsonl=rest test.jsonl=rest` — two specs claiming the remainder.
Common situations: Copy-pasting a `=rest` spec when adding an extra split; adapting a two-way split template to three-way without converting one rest to an explicit size.
Related errors
- --languages and/or --extensions is required (use --list to s
- unknown teacher backend `{s}`. Valid options: sonnet45, sonn
- unknown provider `{provider}`. Valid options: mercury, zeta1
- unknown teacher backend or zeta format `{arg}`
- parse-output only supports Teacher and Zeta2 providers, got
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/6e417c4a56071dbc.
Report an issue: GitHub.