{"record":{"id":"53bb3fb1ea134e88","repo":"jesseduffield/lazygit","slug":"cannot-change-the-rename-similarity-threshold-whil","errorCode":null,"errorMessage":"Cannot change the rename similarity threshold while in patch building mode, because the custom patch can't cope with a rename turning into a delete and add underneath it.","messagePattern":"Cannot change the rename similarity threshold while in patch building mode, because the custom patch can't cope with a rename turning into a delete and add underneath it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/rename_similarity_threshold_controller.go","lineNumber":100,"sourceCode":"\n\tcurrentContext := self.c.Context().CurrentSide()\n\tswitch currentContext.GetKey() {\n\t// we make an exception for the files and commit-files contexts, because\n\t// they actually need to refresh their state afterwards: a changed threshold\n\t// can turn a rename into a separate delete and add, or vice versa.\n\tcase context.FILES_CONTEXT_KEY:\n\t\tself.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})\n\tcase context.COMMIT_FILES_CONTEXT_KEY:\n\t\tself.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMIT_FILES}})\n\tdefault:\n\t\tcurrentContext.HandleRenderToMain()\n\t}\n\treturn nil\n}\n\nfunc (self *RenameSimilarityThresholdController) checkCanChangeThreshold() error {\n\tif self.c.Git().Patch.PatchBuilder.Active() {\n\t\treturn errors.New(self.c.Tr.CantChangeRenameThresholdError)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":82,"sourceCodeEnd":105,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/rename_similarity_threshold_controller.go#L82-L105","documentation":"Returned by RenameSimilarityThresholdController.checkCanChangeThreshold when the custom patch builder is active (Git().Patch.PatchBuilder.Active()). Rename detection affects how diffs are decomposed; if a rename turns into a delete+add while a custom patch is being built, the patch's file list becomes invalid, so the threshold cannot be changed mid-patch-building.","triggerScenarios":"Pressing the rename-similarity-threshold keybinding while a custom patch is in progress in the commit-files / files diff view (PatchBuilder.Active() == true).","commonSituations":"User is staging selected lines/hunks and simultaneously wants to tune rename detection; forgot they are mid patch-building from an earlier partial-stage.","solutions":["Finish or discard the custom patch first (clear the patch), then change the threshold.","Reset patch building via the patch-building menu's reset option and retry the threshold toggle.","Set git.renameSimilarityThreshold (or similar) in config beforehand so no in-session change is needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if self.c.Git().Patch.PatchBuilder.Active() {\n    // defer threshold change until patch building is done\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check PatchBuilder.Active() before exposing the rename-threshold action.","Set the similarity threshold in config ahead of starting patch building.","Reset the in-progress patch before changing diff-affecting settings."],"tags":["patch-building","rename-detection","diff","state-guard"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}