denoland/deno · error
Unable to convert fix: {:#}
Error message
Unable to convert fix: {:#} What it means
While computing quick-fix code actions for a diagnostic, every tsc fix action is converted into an LSP code action via collector.add_ts_fix_action; this error wraps a conversion failure for one of them. The usual root cause is mapping a tsc text span to an LSP range through the module's line index — for example a span that no longer fits the document after unsynchronized edits — but any converter error surfaces here and aborts the whole code action request.
Source
Thrown at cli/lsp/ts_server.rs:406
lsp_warn!(
"Unable to get code fixes from TypeScript: {:#}",
err
);
}
vec![]
});
for fix_action in fix_actions {
if token.is_cancelled() {
return Err(anyhow!("request cancelled"));
}
collector
.add_ts_fix_action(
&fix_action,
diagnostic,
module,
language_server,
)
.map_err(|err| anyhow!("Unable to convert fix: {:#}", err))?;
if collector.is_fix_all_action(
&fix_action,
diagnostic,
&file_diagnostics,
) {
collector.add_ts_fix_all_action(&fix_action, module, diagnostic);
}
}
}
let mut actions = collector
.into_code_actions(has_deno_code_actions)
.map(lsp::CodeActionOrCommand::CodeAction)
.collect::<Vec<_>>();
let only = context
.only
.as_ref()View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Save the file and re-request the quick fix once edits settle, so the server's snapshot matches the editor.
- Run "Deno: Restart Language Server" if the error persists for a specific file.
- Update the Deno CLI and extension — conversion bugs against particular tsc fix shapes get patched.
- Inspect the wrapped error after the colon in the Deno Language Server output to identify which fix failed.
Defensive patterns
Strategy: fallback
Try / catch
// If quick-fix conversion fails, degrade gracefully: keep the editor's
// built-in actions instead of failing the whole code action request.
async function codeActionsSafe(client, params) {
try {
return await client.sendRequest('textDocument/codeAction', params);
} catch (err) {
if (String(err?.message).includes('Unable to convert fix')) {
console.warn('quick fixes unavailable:', err.message);
return [];
}
throw err;
}
} Prevention
- Save the file before invoking Quick Fix so the server snapshot matches the editor
- Avoid auto-fix-on-save racing concurrent edits
- Restart the language server when one file's quick fixes keep failing, and update Deno
When it happens
Trigger: A codeActions request for a diagnostic that has tsc fixes available, where converting one fix action fails — commonly immediately after edits while the client's document version and the server snapshot disagree, or for fixes spanning files not present in the snapshot.
Common situations: Invoking Quick Fix while still typing; editor auto-fix-on-save racing concurrent edits; older Deno versions with span-conversion bugs against specific fix shapes.
Related errors
- Unable to get refactor info from TypeScript: {:#}
- Unable to convert refactor info: {:#}
- Unable to get organize imports edit from TypeScript: {:#}
- Type checking failed: {}
- Error getting navigation tree for "{}": {:#}
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/baee47dc788a02ae.
Report an issue: GitHub.