denoland/deno · error
Unable to get refactor info from TypeScript: {:#}
Error message
Unable to get refactor info from TypeScript: {:#} What it means
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.
Source
Thrown at cli/lsp/ts_server.rs:440
let only = context
.only
.as_ref()
.and_then(|o| o.first())
.map(|v| v.as_str().to_owned())
.unwrap_or_default();
let refactor_infos = ts_server
.get_applicable_refactors(
snapshot.clone(),
module,
module.line_index.offset_tsc(range.start)?
..module.line_index.offset_tsc(range.end)?,
context.trigger_kind,
only,
token,
)
.await
.map_err(|err| {
anyhow!("Unable to get refactor info from TypeScript: {:#}", err)
})?;
let refactor_actions = refactor_infos
.into_iter()
.map(|refactor_info| {
refactor_info
.to_code_actions(&module.uri, &range, token)
.map_err(|err| {
anyhow!("Unable to convert refactor info: {:#}", err)
})
})
.collect::<Result<Vec<_>, _>>()?
.into_iter()
.flatten();
actions.extend(
refactor::prune_invalid_actions(refactor_actions, 5)
.into_iter()
.map(lsp::CodeActionOrCommand::CodeAction),
);View on GitHub (pinned to 9ad36f7a2c)
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.
Defensive patterns
Strategy: retry
Try / catch
// Refactor listings: retry the request once — get_applicable_refactors
// failures are usually cancellation-related.
async function refactorsWithRetry(client, params) {
try {
return await client.sendRequest('textDocument/codeAction', params);
} catch (err) {
if (String(err?.message).includes('Unable to get refactor info')) {
await sleep(250);
return await client.sendRequest('textDocument/codeAction', params);
}
throw err;
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Invoking refactoring during heavy editing sessions; intermittent failures while the language server is restarting or under load.
Related errors
- Unable to convert refactor info: {:#}
- Unable to convert fix: {:#}
- Unable to get organize imports edit from TypeScript: {:#}
- Error getting navigation tree for "{}": {:#}
- Unable to convert document highlights: {:#}
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/0bb4712d3d983c5c.
Report an issue: GitHub.