{"record":{"id":"d2238b76a9c84e9a","repo":"denoland/deno","slug":"unable-to-covert-rename-locations","errorCode":null,"errorMessage":"Unable to covert rename locations: {:#}","messagePattern":"Unable to covert rename locations: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/ts_server.rs","lineNumber":985,"sourceCode":"          })\n          .unwrap_or_default();\n          if let Some(locations) = locations {\n            locations_with_modules\n              .extend(locations.into_iter().map(|l| (l, module.clone())));\n          }\n        }\n        if locations_with_modules.is_empty() {\n          Ok(None)\n        } else {\n          let workspace_edit =\n            tsc::RenameLocation::collect_into_workspace_edit(\n              locations_with_modules,\n              new_name,\n              language_server,\n              token,\n            )\n            .map_err(|err| {\n              anyhow!(\"Unable to covert rename locations: {:#}\", err)\n            })?;\n          Ok(Some(workspace_edit))\n        }\n      }\n    }\n  }\n\n  pub async fn provide_selection_ranges(\n    &self,\n    module: &DocumentModule,\n    positions: &[lsp::Position],\n    snapshot: Arc<StateSnapshot>,\n    token: &CancellationToken,\n  ) -> Result<Option<Vec<lsp::SelectionRange>>, AnyError> {\n    match self {\n      Self::Js(ts_server) => {\n        let mut selection_ranges = Vec::with_capacity(positions.len());\n        for &position in positions {","sourceCodeStart":967,"sourceCodeEnd":1003,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lsp/ts_server.rs#L967-L1003","documentation":"For rename requests, tsc's RenameLocations are assembled into a WorkspaceEdit via tsc::RenameLocation::collect_into_workspace_edit; this wraps a failure of that assembly. Causes include span-to-range conversion failures in any file containing an occurrence, edits that cannot be expressed against documents that changed since the locations were computed, or an invalid new name. The message text is verbatim from the source, including its 'covert' typo for 'convert'.","triggerScenarios":"A textDocument/rename (F2) where at least one rename location fails to convert into an edit — e.g. a file containing an occurrence was edited or closed after locations were gathered, or the new name produces an edit that cannot be mapped.","commonSituations":"Renaming a symbol with many occurrences across dirty (unsaved) files; renaming right after refactoring moves; large workspaces where some occurrence files have stale snapshots.","solutions":["Save all dirty files so occurrence documents match the server snapshot, then retry the rename.","Retry once after a moment — transient snapshot races resolve on the next request.","Run \"Deno: Restart Language Server\" if renames keep failing in one workspace.","Update Deno; check the wrapped error after the colon in the language server output."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// A failed workspace-edit assembly must NOT apply a partial rename:\n// abort and inform the user instead.\ntry {\n  const edit = await client.sendRequest('textDocument/rename', params);\n  await client.applyEdit(edit);\n} catch (err) {\n  if (String(err?.message).includes('covert rename locations')) {\n    showWarning('Rename aborted — save all files and try again.');\n  } else {\n    throw err;\n  }\n}","preventionTips":["Save all dirty files before renaming symbols with many occurrences","Retry the rename after a moment; snapshot races resolve on the next request","Restart the language server when renames keep failing in a workspace"],"tags":["lsp","rename","tsc","workspace-edit"],"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"}