zed-industries/zed · error

Placeholder choice doesn't contain closing pipe-character '|

Error message

Placeholder choice doesn't contain closing pipe-character '|'

What it means

Snippet parser guard in parse_choices(): while scanning a placeholder's choice list, the terminating '|' was never found before the input ran out, so the choice syntax (${n|a,b|}) is unterminated/malformed.

Source

Thrown at crates/snippet/src/snippet.rs:181

                    }
                    source = &source[c.len_utf8()..];
                }
            }
            Some(',') => {
                found_default_choice = true;
                source = &source[1..];
                choices.push(current_choice);
                current_choice = String::new();
            }
            Some('|') => {
                source = &source[1..];
                choices.push(current_choice);
                return Ok((source, Some(choices)));
            }
            Some(_) => {
                let chunk_end = source.find([',', '|', '\\']);

                anyhow::ensure!(
                    chunk_end.is_some(),
                    "Placeholder choice doesn't contain closing pipe-character '|'"
                );

                let (chunk, rest) = source.split_at(chunk_end.unwrap());

                if !found_default_choice {
                    text.push_str(chunk);
                }

                current_choice.push_str(chunk);
                source = rest;
            }
        }
    }
}

#[cfg(test)]

View on GitHub (pinned to f4178619ac)

Solutions

  1. Close the choice list with '|' inside the placeholder
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/snippet/src/snippet.rs:181 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/bcea9acde565544e. Report an issue: GitHub.