{"record":{"id":"e3212a87e3710741","repo":"oraios/serena","slug":"language-server-not-started-e3212a","errorCode":null,"errorMessage":"Language Server not started","messagePattern":"Language Server not started","errorType":"exception","errorClass":"SolidLSPException","httpStatus":null,"severity":"error","filePath":"src/solidlsp/ls.py","lineNumber":816,"sourceCode":"        diagnostics: list[ls_types.Diagnostic],\n        start_line: int,\n        end_line: int,\n        min_severity: int,\n    ) -> 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","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/ls.py#L798-L834","documentation":"request_text_document_diagnostics and its cached/published variants call _validate_text_document_diagnostics_request first. If the underlying language server process has not been started yet (self.server_started is False), a SolidLSPException('Language Server not started') is raised, because there is no server to publish or query diagnostics from.","triggerScenarios":"Calling request_text_document_diagnostics, request_published_text_document_diagnostics, or get_cached_published_text_document_diagnostics before start()/initialization of the SolidLSP instance completes (or after the server failed to start).","commonSituations":"Calling diagnostics from another thread/async task before await start(); constructing the language server and immediately querying; the LS crashed on startup so server_started never became True.","solutions":["Call and await language_server.start() before requesting diagnostics","Check the server_started flag or gate queries behind a start-completed event","Investigate server startup logs if start() was called but the flag is still False (server may have crashed)"],"exampleFix":"// before\nls = SolidLSP(repo_root)\ndiags = ls.request_text_document_diagnostics(\"src/a.py\", 0, -1, 3)\n// after\nls = SolidLSP(repo_root)\nls.start()\ndiags = ls.request_text_document_diagnostics(\"src/a.py\", 0, -1, 3)","handlingStrategy":"try-catch","validationCode":"if not ls.server_started:\n    ls.start()","typeGuard":null,"tryCatchPattern":"try:\n    diags = ls.request_text_document_diagnostics(rel_path, 0, -1, 3)\nexcept SolidLSPException as e:\n    if \"not started\" in str(e):\n        ls.start()\n        diags = ls.request_text_document_diagnostics(rel_path, 0, -1, 3)\n    else:\n        raise","preventionTips":["Always await/complete start() before any request_* call","Serialize startup and queries (no requests from threads before start resolves)","Monitor server health; restart and retry if the server crashed"],"tags":["lsp","lifecycle","diagnostics","not-started"],"backgroundTag":"language-server-not-started","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}