{"record":{"id":"93b93f21cc499e3f","repo":"denoland/deno","slug":"unable-to-fix-import-changes","errorCode":null,"errorMessage":"Unable to fix import changes: {:#}","messagePattern":"Unable to fix import changes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/ts_server.rs","lineNumber":1183,"sourceCode":"              continue;\n            }\n            let changes = ts_server\n              .get_edits_for_file_rename(\n                snapshot.clone(),\n                &module,\n                &uri_to_url(&Uri::from_str(&rename.new_uri).unwrap()),\n                token,\n              )\n              .await?;\n            let changes = fix_ts_import_changes_for_file_rename(\n              changes,\n              &rename.new_uri,\n              &module,\n              language_server,\n              token,\n            )\n            .map_err(|err| {\n              anyhow!(\"Unable to fix import changes: {:#}\", err)\n            })?;\n            if !changes.is_empty() {\n              changes_with_modules\n                .extend(changes.into_iter().map(|c| (c, module.clone())));\n            }\n          }\n        }\n        file_text_changes_to_workspace_edit(\n          changes_with_modules.iter().map(|(c, m)| (c, m.as_ref())),\n          &snapshot,\n          token,\n        )\n      }\n    }\n  }\n\n  pub async fn provide_inlay_hint(\n    &self,","sourceCodeStart":1165,"sourceCodeEnd":1201,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lsp/ts_server.rs#L1165-L1201","documentation":"During workspace/willRename of files, the LSP asks tsc for import-rewriting edits, then post-processes them with fix_ts_import_changes_for_file_rename so import specifiers that referenced the old file path are corrected; this wraps a failure of that fix-up step. Causes include mapping the returned text changes through the line index of importing modules that changed concurrently, and URIs that fail to parse or resolve against the snapshot.","triggerScenarios":"Renaming or moving a file in the IDE while modules that import it are dirty or were just edited; the import-change fix-up then fails to map edits through a stale line index.","commonSituations":"Dragging files in the explorer with many unsaved importers; renaming a file inside a workspace mid-refactor; intermittent during rapid multi-file edits.","solutions":["Save all files that import the one being renamed, then repeat the rename.","Retry the rename once edits settle — snapshot races clear on the next attempt.","Run \"Deno: Restart Language Server\" if file renames consistently fail to update imports.","Update Deno; check the wrapped error after the colon in the language server output."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// willRename failures should not block the file rename itself: proceed\n// without automatic import rewrites and warn.\ntry {\n  const edit = await client.sendRequest('workspace/willRename', params);\n  if (edit) await client.applyEdit(edit);\n} catch (err) {\n  if (String(err?.message).includes('Unable to fix import changes')) {\n    showWarning('File renamed; update importing specifiers manually.');\n  } else {\n    throw err;\n  }\n}","preventionTips":["Save all files that import the file being renamed before renaming or moving it","Retry the rename once edits settle so import rewrites apply","Restart the language server when file renames consistently skip import updates"],"tags":["lsp","file-rename","imports","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"}