{"record":{"id":"baee47dc788a02ae","repo":"denoland/deno","slug":"unable-to-convert-fix","errorCode":null,"errorMessage":"Unable to convert fix: {:#}","messagePattern":"Unable to convert fix: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/ts_server.rs","lineNumber":406,"sourceCode":"                lsp_warn!(\n                  \"Unable to get code fixes from TypeScript: {:#}\",\n                  err\n                );\n              }\n              vec![]\n            });\n          for fix_action in fix_actions {\n            if token.is_cancelled() {\n              return Err(anyhow!(\"request cancelled\"));\n            }\n            collector\n              .add_ts_fix_action(\n                &fix_action,\n                diagnostic,\n                module,\n                language_server,\n              )\n              .map_err(|err| anyhow!(\"Unable to convert fix: {:#}\", err))?;\n            if collector.is_fix_all_action(\n              &fix_action,\n              diagnostic,\n              &file_diagnostics,\n            ) {\n              collector.add_ts_fix_all_action(&fix_action, module, diagnostic);\n            }\n          }\n        }\n\n        let mut actions = collector\n          .into_code_actions(has_deno_code_actions)\n          .map(lsp::CodeActionOrCommand::CodeAction)\n          .collect::<Vec<_>>();\n\n        let only = context\n          .only\n          .as_ref()","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lsp/ts_server.rs#L388-L424","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// If quick-fix conversion fails, degrade gracefully: keep the editor's\n// built-in actions instead of failing the whole code action request.\nasync function codeActionsSafe(client, params) {\n  try {\n    return await client.sendRequest('textDocument/codeAction', params);\n  } catch (err) {\n    if (String(err?.message).includes('Unable to convert fix')) {\n      console.warn('quick fixes unavailable:', err.message);\n      return [];\n    }\n    throw err;\n  }\n}","preventionTips":["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"],"tags":["lsp","code-actions","quick-fix","tsc","diagnostics"],"backgroundTag":"lsp-tsc-conversion-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"}