{"record":{"id":"c20f09f924d4742b","repo":"denoland/deno","slug":"unable-to-convert-refactor-info","errorCode":null,"errorMessage":"Unable to convert refactor info: {:#}","messagePattern":"Unable to convert refactor info: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/ts_server.rs","lineNumber":448,"sourceCode":"            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        );\n\n        if !snapshot.config.client_provided_organize_imports_capable()\n          && context.only.as_ref().is_none_or(|o| {\n            o.contains(&lsp::CodeActionKind::SOURCE_ORGANIZE_IMPORTS)\n          })\n        {\n          let organize_imports_edit = ts_server\n            .organize_imports(snapshot.clone(), module, token)","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lsp/ts_server.rs#L430-L466","documentation":"After tsc returns applicable refactor infos, each is converted into LSP code actions via refactor_info.to_code_actions; this wraps a conversion failure for one entry. Causes include refactor spans that fail to map through the module's line index (stale snapshot) and refactor metadata whose shape the server does not expect from the embedded TypeScript version.","triggerScenarios":"A code action request over a range where one refactor info entry fails conversion — spans that do not map onto the current document snapshot, or a tsc/server version mismatch in the expected refactor JSON shape.","commonSituations":"Requesting refactorings right after rapid edits; mixing an outdated VS Code extension with a newer Deno CLI (or vice versa).","solutions":["Save the file and retry the refactoring after edits settle.","Ensure the Deno CLI and IDE extension are both current and matched — refactor info shapes change between tsc versions.","Run \"Deno: Restart Language Server\" if the failure persists.","Inspect the wrapped error after the colon in the language server output."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// One bad refactor entry aborts the whole conversion on the server;\n// fall back to offering no server refactors for that invocation.\ntry {\n  actions = await collectRefactorActions(client, params);\n} catch (err) {\n  if (String(err?.message).includes('Unable to convert refactor info')) {\n    actions = []; // user can still rename/extract manually; log for triage\n  } else {\n    throw err;\n  }\n}","preventionTips":["Save before opening the refactor menu so spans map onto the current snapshot","Keep Deno CLI and VS Code extension versions aligned — refactor info shapes change with tsc","Restart the language server if the failure persists for a specific selection"],"tags":["lsp","refactor","code-actions","tsc"],"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"}