astral-sh/ruff · error · Error
Invalid value `0` for `position.column`. The column index is
Error message
Invalid value `0` for `position.column`. The column index is 1-indexed.
What it means
A wasm-bindgen Error from Position::to_text_size: the caller passed 0 for position.column. Columns are 1-indexed in the wasm API (via OneIndexed), so 0 is invalid and cannot be mapped to a text offset.
Source
Thrown at crates/ty_wasm/src/lib.rs:1188
}
}
impl Position {
fn to_text_size(
self,
text: &str,
index: &LineIndex,
position_encoding: PositionEncoding,
) -> Result<TextSize, Error> {
let text_size = index.offset(
SourceLocation {
line: OneIndexed::new(self.line).ok_or_else(|| {
Error::new(
"Invalid value `0` for `position.line`. The line index is 1-indexed.",
)
})?,
character_offset: OneIndexed::new(self.column).ok_or_else(|| {
Error::new(
"Invalid value `0` for `position.column`. The column index is 1-indexed.",
)
})?,
},
text,
position_encoding.into(),
);
Ok(text_size)
}
fn from_text_size(
offset: TextSize,
line_index: &LineIndex,
source: &str,
position_encoding: PositionEncoding,
) -> Self {
let location = line_index.source_location(offset, source, position_encoding.into());View on GitHub (pinned to 26f38c119c)
Solutions
- Pass a 1-indexed column number (first column is 1)
- Convert 0-based editor coordinates to 1-based before calling the API
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/ty_wasm/src/lib.rs:1188 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05).
Data as JSON: /api/errors/c8b6adb9500095a5.
Report an issue: GitHub.