{"record":{"id":"f4cfe2eaf37acb3c","repo":"astral-sh/ruff","slug":"invalid-value-0-for-position-line-the-line-in","errorCode":null,"errorMessage":"Invalid value `0` for `position.line`. The line index is 1-indexed.","messagePattern":"Invalid value `0` for `position\\.line`\\. The line index is 1-indexed\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/ty_wasm/src/lib.rs","lineNumber":1183,"sourceCode":"#[wasm_bindgen]\nimpl Position {\n    #[wasm_bindgen(constructor)]\n    pub fn new(line: usize, column: usize) -> Self {\n        Self { line, column }\n    }\n}\n\nimpl Position {\n    fn to_text_size(\n        self,\n        text: &str,\n        index: &LineIndex,\n        position_encoding: PositionEncoding,\n    ) -> Result<TextSize, Error> {\n        let text_size = index.offset(\n            SourceLocation {\n                line: OneIndexed::new(self.line).ok_or_else(|| {\n                    Error::new(\n                        \"Invalid value `0` for `position.line`. The line index is 1-indexed.\",\n                    )\n                })?,\n                character_offset: OneIndexed::new(self.column).ok_or_else(|| {\n                    Error::new(\n                        \"Invalid value `0` for `position.column`. The column index is 1-indexed.\",\n                    )\n                })?,\n            },\n            text,\n            position_encoding.into(),\n        );\n\n        Ok(text_size)\n    }\n\n    fn from_text_size(\n        offset: TextSize,","sourceCodeStart":1165,"sourceCodeEnd":1201,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_wasm/src/lib.rs#L1165-L1201","documentation":"A wasm-bindgen Error from Position::to_text_size: the caller passed 0 for position.line. The wasm API mirrors 1-based editor coordinates (via OneIndexed), so line 0 is out of range and cannot be converted to an offset.","triggerScenarios":"Thrown at crates/ty_wasm/src/lib.rs:1183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a 1-indexed line number (first line is 1)","Convert 0-based editor coordinates to 1-based before calling the API"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}