zed-industries/zed · error
expected an integer
Error message
expected an integer
What it means
Raised in parse_int while parsing snippet tabstop syntax when the parser expects digits (e.g. after `${` or `:` in a placeholder/choice) but the next characters are not an ASCII digit. The tabstop index is missing or malformed, so the snippet parse fails at that offset.
Source
Thrown at crates/snippet/src/snippet.rs:140
source = rest;
}
tabstops
.entry(tabstop_index)
.or_insert_with(|| TabStop {
ranges: Default::default(),
choices,
})
.ranges
.push(tabstop_start as isize..text.len() as isize);
Ok(source)
}
fn parse_int(source: &str) -> Result<(usize, &str)> {
let len = source
.find(|c: char| !c.is_ascii_digit())
.unwrap_or(source.len());
anyhow::ensure!(len > 0, "expected an integer");
let (prefix, suffix) = source.split_at(len);
Ok((prefix.parse()?, suffix))
}
fn parse_choices<'a>(
mut source: &'a str,
text: &mut String,
) -> Result<(&'a str, Option<Vec<String>>)> {
let mut found_default_choice = false;
let mut current_choice = String::new();
let mut choices = Vec::new();
loop {
match source.chars().next() {
None => return Ok(("", Some(choices))),
Some('\\') => {
source = &source[1..];
View on GitHub (pinned to f4178619ac)
Solutions
- Fix the snippet syntax: tabstops must be $0, $1, ${2:...} etc.
- Remove stray $ or { characters
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/snippet/src/snippet.rs:140 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/e406c7e364f3004d.
Report an issue: GitHub.