{"record":{"id":"1df1953e28f76d06","repo":"oraios/serena","slug":"companion-typescript-server-did-not-finish-indexin","errorCode":null,"errorMessage":"Companion TypeScript server did not finish indexing {len(svelte_files)} .svelte files within {timeout:.0f}s ({self._ts_server.describe_indexing_state()})","messagePattern":"Companion TypeScript server did not finish indexing (.+?) \\.svelte files within (.+?)s \\((.+?)\\)","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/svelte_language_server.py","lineNumber":394,"sourceCode":"                    first_open_error = exc\n                failed_svelte_files.append(svelte_file)\n\n        if failed_svelte_files:\n            shown_files = sorted(failed_svelte_files)[:_MAX_FAILED_FILES_IN_ERROR]\n            remainder = len(failed_svelte_files) - len(shown_files)\n            listing = \", \".join(shown_files) + (f\" and {remainder} more\" if remainder else \"\")\n            raise SvelteCompanionPreparationError(\n                f\"Failed to open {len(failed_svelte_files)} Svelte file(s) on companion TypeScript server: {listing}\"\n            ) from first_open_error\n\n        self._svelte_files_indexed = True\n        log.info(\"Svelte file indexing complete; waiting for companion TS server to finish processing\")\n\n        timeout = self._get_companion_indexing_timeout()\n        if self._ts_server._wait_for_indexing_start_or_completion(timeout=timeout):\n            log.info(\"Companion TypeScript server finished indexing .svelte files\")\n        else:\n            raise TimeoutError(\n                f\"Companion TypeScript server did not finish indexing {len(svelte_files)} .svelte files within {timeout:.0f}s \"\n                f\"({self._ts_server.describe_indexing_state()})\"\n            )\n\n    def _cleanup_indexed_svelte_files(self) -> None:\n        \"\"\"Decrement ref-counts for all .svelte files opened during indexing.\"\"\"\n        if not self._indexed_svelte_file_uris or self._ts_server is None:\n            return\n        log.debug(\"Cleaning up %d indexed .svelte files\", len(self._indexed_svelte_file_uris))\n        for uri in self._indexed_svelte_file_uris:\n            try:\n                if uri in self._ts_server.open_file_buffers:\n                    file_buffer = self._ts_server.open_file_buffers[uri]\n                    file_buffer.ref_count -= 1\n                    if file_buffer.ref_count == 0:\n                        self._ts_server.server.notify.did_close_text_document({\"textDocument\": {\"uri\": uri}})\n                        del self._ts_server.open_file_buffers[uri]\n            except Exception as exc:","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/svelte_language_server.py#L376-L412","documentation":"After opening all .svelte files on the companion TypeScript server, the Svelte LS waits (bounded by the `indexing_timeout` setting, default from SvelteTypeScriptServer.INDEXING_PROGRESS_TIMEOUT) for tsserver to report indexing start/completion via project-wide diagnostics/progress. If `_wait_for_indexing_start_or_completion` returns False, this TimeoutError is raised including the file count, the timeout, and the server's `describe_indexing_state()` snapshot for diagnosis.","triggerScenarios":"Calling _start_typescript_server (startup of the Svelte LS) when the companion tsserver never signals indexing completion within `indexing_timeout` seconds — typically with very large .svelte trees, a slow/hung tsserver, or progress events not observed.","commonSituations":"Monorepos with thousands of .svelte files exhausting tsserver; low CPU/memory making tsserver slow; a hung or crashed tsserver process; TypeScript project misconfiguration causing the plugin never to finish; setting `indexing_timeout` (svelte-specific or typescript ls-specific settings) too low for the repo size.","solutions":["Raise `indexing_timeout` in the svelte LS-specific settings (or the TYPESCRIPT ls settings): e.g. {\"indexing_timeout\": 300}.","Inspect the `describe_indexing_state()` text in the message — it tells whether indexing never started, was in progress, or stalled.","Reduce the number of .svelte files tsserver must process (exclude generated/dist trees, split the repo).","Ensure node/tsserver has adequate CPU and memory; check tsserver logs for crashes or OOM.","Retry after fixing; the timeout is a startup-time wait, not a permanent state."],"exampleFix":"// before (default timeout too small for a monorepo)\nsettings = {}\n// after\nsettings = {\"ls_specific_settings\": {\"svelte\": {\"indexing_timeout\": 300}}}","handlingStrategy":"validation","validationCode":"repo = Path(repo_path)\nsvelte_count = sum(1 for p in repo.rglob(\"*.svelte\")\n                   if \"node_modules\" not in p.parts)\n# scale the timeout to the repo size before configuring the LS\nsettings[\"ls_specific_settings\"][\"svelte\"] = {\n    \"indexing_timeout\": max(120, svelte_count * 0.5)\n}","typeGuard":null,"tryCatchPattern":"try:\n    server.start()\nexcept TimeoutError as e:\n    if \"did not finish indexing\" in str(e):\n        # state snapshot is embedded in the message; raise timeout or retry once\n        log.warning(\"companion indexing slow: %s\", e)\n        server = retry_with_longer_timeout()\n    else:\n        raise","preventionTips":["Set indexing_timeout generously for large .svelte repos (e.g. 300s)","Keep thousands of generated .svelte files out of the project tree","Give tsserver enough CPU/RAM; watch for OOM kills","Verify the typescript-svelte-plugin and typescript versions are compatible","Read the describe_indexing_state() text in the message to diagnose never-started vs stalled indexing"],"tags":["timeout","typescript","svelte","indexing","companion-server"],"backgroundTag":"lsp-indexing-timeout","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}