denoland/deno · error

Unable to covert rename locations: {:#}

Error message

Unable to covert rename locations: {:#}

What it means

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'.

Source

Thrown at cli/lsp/ts_server.rs:985

          })
          .unwrap_or_default();
          if let Some(locations) = locations {
            locations_with_modules
              .extend(locations.into_iter().map(|l| (l, module.clone())));
          }
        }
        if locations_with_modules.is_empty() {
          Ok(None)
        } else {
          let workspace_edit =
            tsc::RenameLocation::collect_into_workspace_edit(
              locations_with_modules,
              new_name,
              language_server,
              token,
            )
            .map_err(|err| {
              anyhow!("Unable to covert rename locations: {:#}", err)
            })?;
          Ok(Some(workspace_edit))
        }
      }
    }
  }

  pub async fn provide_selection_ranges(
    &self,
    module: &DocumentModule,
    positions: &[lsp::Position],
    snapshot: Arc<StateSnapshot>,
    token: &CancellationToken,
  ) -> Result<Option<Vec<lsp::SelectionRange>>, AnyError> {
    match self {
      Self::Js(ts_server) => {
        let mut selection_ranges = Vec::with_capacity(positions.len());
        for &position in positions {

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Save all dirty files so occurrence documents match the server snapshot, then retry the rename.
  2. Retry once after a moment — transient snapshot races resolve on the next request.
  3. Run "Deno: Restart Language Server" if renames keep failing in one workspace.
  4. Update Deno; check the wrapped error after the colon in the language server output.
Defensive patterns

Strategy: try-catch

Try / catch

// A failed workspace-edit assembly must NOT apply a partial rename:
// abort and inform the user instead.
try {
  const edit = await client.sendRequest('textDocument/rename', params);
  await client.applyEdit(edit);
} catch (err) {
  if (String(err?.message).includes('covert rename locations')) {
    showWarning('Rename aborted — save all files and try again.');
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Renaming a symbol with many occurrences across dirty (unsaved) files; renaming right after refactoring moves; large workspaces where some occurrence files have stale snapshots.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/d2238b76a9c84e9a. Report an issue: GitHub.