{"record":{"id":"f3ac12f1903f6ac7","repo":"oraios/serena","slug":"end-line-must-be-1-or-start-line-got-end-lin","errorCode":null,"errorMessage":"end_line must be -1 or >= start_line, got {end_line} < {start_line}","messagePattern":"end_line must be -1 or >= start_line, got (.+?) < (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/ls.py","lineNumber":820,"sourceCode":"    ) -> list[ls_types.Diagnostic]:\n        diagnostics = [d for d in diagnostics if cls._diagnostic_matches_range(d, start_line, end_line)]\n        diagnostics = [d for d in diagnostics if cls._diagnostic_matches_min_severity(d, min_severity)]\n        return diagnostics\n\n    def _validate_text_document_diagnostics_request(\n        self,\n        relative_file_path: str,\n        start_line: int,\n        end_line: int,\n        min_severity: int,\n    ) -> str:\n        if not self.server_started:\n            log.error(\"request_text_document_diagnostics called before Language Server started\")\n            raise SolidLSPException(\"Language Server not started\")\n        if start_line < 0:\n            raise ValueError(f\"start_line must be non-negative, got {start_line}\")\n        if end_line != -1 and end_line < start_line:\n            raise ValueError(f\"end_line must be -1 or >= start_line, got {end_line} < {start_line}\")\n        if min_severity not in {1, 2, 3, 4}:\n            raise ValueError(f\"min_severity must be one of 1, 2, 3, 4, got {min_severity}\")\n        return pathlib.Path(str(PurePath(self.repository_root_path, relative_file_path))).as_uri()\n\n    def get_published_diagnostics_generation(self, relative_file_path: str) -> int:\n        \"\"\"\n        Get the generation number for the latest published diagnostics of a file.\n\n        :param relative_file_path: The relative path of the file.\n        :return: the generation number, or ``-1`` if none were published yet.\n        \"\"\"\n        uri = pathlib.Path(str(PurePath(self.repository_root_path, relative_file_path))).as_uri()\n        return self._get_published_diagnostics_generation(uri)\n\n    def get_cached_published_text_document_diagnostics(\n        self,\n        relative_file_path: str,\n        start_line: int = 0,","sourceCodeStart":802,"sourceCodeEnd":838,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/ls.py#L802-L838","documentation":"_validate_text_document_diagnostics_request requires the requested line range to be coherent: end_line may be -1 (meaning 'to end of file') or must be >= start_line. Otherwise a ValueError is raised because a range ending before it starts cannot yield meaningful diagnostics.","triggerScenarios":"Calling request_text_document_diagnostics / request_published_text_document_diagnostics / get_cached_published_text_document_diagnostics with an end_line other than -1 that is smaller than start_line (e.g. swapped arguments or wrong sentinel).","commonSituations":"Swapping start/end parameters at the call site; passing -1 to start_line instead of end_line; computing end_line from an empty/short span.","solutions":["Ensure end_line is -1 (whole file) or >= start_line","Swap arguments if start/end were accidentally reversed","Guard computed ranges: end = max(start, end) or use -1 for open-ended ranges"],"exampleFix":"// before\nls.request_text_document_diagnostics(\"src/a.py\", 10, 5, 3)\n// after\nls.request_text_document_diagnostics(\"src/a.py\", 5, 10, 3)  # or end_line=-1 for EOF","handlingStrategy":"validation","validationCode":"if end_line != -1 and end_line < start_line:\n    start_line, end_line = end_line, start_line  # or set end_line = -1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check argument order (start, end) at call sites","Use -1 sentinel for open-ended ranges","Normalize ranges: end = -1 if end < start else end"],"tags":["validation","diagnostics","arguments","range"],"backgroundTag":"invalid-argument-value","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}