{"record":{"id":"0bb4712d3d983c5c","repo":"denoland/deno","slug":"unable-to-get-refactor-info-from-typescript","errorCode":null,"errorMessage":"Unable to get refactor info from TypeScript: {:#}","messagePattern":"Unable to get refactor info from TypeScript: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/ts_server.rs","lineNumber":440,"sourceCode":"        let only = context\n          .only\n          .as_ref()\n          .and_then(|o| o.first())\n          .map(|v| v.as_str().to_owned())\n          .unwrap_or_default();\n        let refactor_infos = ts_server\n          .get_applicable_refactors(\n            snapshot.clone(),\n            module,\n            module.line_index.offset_tsc(range.start)?\n              ..module.line_index.offset_tsc(range.end)?,\n            context.trigger_kind,\n            only,\n            token,\n          )\n          .await\n          .map_err(|err| {\n            anyhow!(\"Unable to get refactor info from TypeScript: {:#}\", err)\n          })?;\n        let refactor_actions = refactor_infos\n          .into_iter()\n          .map(|refactor_info| {\n            refactor_info\n              .to_code_actions(&module.uri, &range, token)\n              .map_err(|err| {\n                anyhow!(\"Unable to convert refactor info: {:#}\", err)\n              })\n          })\n          .collect::<Result<Vec<_>, _>>()?\n          .into_iter()\n          .flatten();\n        actions.extend(\n          refactor::prune_invalid_actions(refactor_actions, 5)\n            .into_iter()\n            .map(lsp::CodeActionOrCommand::CodeAction),\n        );","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lsp/ts_server.rs#L422-L458","documentation":"Wraps a failure of the tsc get_applicable_refactors request, which lists refactorings available for a selection (extract variable/function, etc.) when building code actions. The underlying tsc error follows the colon. Typical causes are request cancellation and internal tsc isolate errors; the request needs no user configuration, so there is rarely anything to fix in project settings.","triggerScenarios":"Opening the lightbulb/source-action menu over a selection sends a codeActions request with a refactor context; the tsc request itself errors — cancelled token, worker crash, or a selection in a file the compiler cannot process.","commonSituations":"Invoking refactoring during heavy editing sessions; intermittent failures while the language server is restarting or under load.","solutions":["Retry the refactor request — transient cancellation failures usually succeed on the next attempt.","Run \"Deno: Restart Language Server\" if refactor suggestions keep failing.","Check the wrapped tsc error after the colon in the Deno Language Server output panel for the root cause.","Update the Deno CLI and IDE extension."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Refactor listings: retry the request once — get_applicable_refactors\n// failures are usually cancellation-related.\nasync function refactorsWithRetry(client, params) {\n  try {\n    return await client.sendRequest('textDocument/codeAction', params);\n  } catch (err) {\n    if (String(err?.message).includes('Unable to get refactor info')) {\n      await sleep(250);\n      return await client.sendRequest('textDocument/codeAction', params);\n    }\n    throw err;\n  }\n}","preventionTips":["Invoke refactorings on a settled (saved) selection","Restart the language server if the refactor menu keeps erroring","Keep the Deno CLI and extension matched and current"],"tags":["lsp","refactor","tsc","code-actions"],"backgroundTag":"lsp-tsc-request-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}