{"record":{"id":"cc5956d7d8b12c29","repo":"golangci/golangci-lint","slug":"conflicting-edits-from-s-and-s-on-s-first-edits","errorCode":null,"errorMessage":"conflicting edits from %s and %s on %s\nfirst edits:\n%s\nsecond edits:\n%s","messagePattern":"conflicting edits from (.+?) and (.+?) on (.+?)\nfirst edits:\n(.+?)\nsecond edits:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/result/processors/fixer.go","lineNumber":304,"sourceCode":"// edits on a file at path.\n// Copy of go/analysis/internal/checker/checker.go\nfunc diff3Conflict(path, xlabel, ylabel string, xedits, yedits []diff.Edit) error {\n\tcontents, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\toldlabel, old := \"base\", string(contents)\n\n\txdiff, err := diff.ToUnified(oldlabel, xlabel, old, xedits, diff.DefaultContextLines)\n\tif err != nil {\n\t\treturn err\n\t}\n\tydiff, err := diff.ToUnified(oldlabel, ylabel, old, yedits, diff.DefaultContextLines)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn fmt.Errorf(\"conflicting edits from %s and %s on %s\\nfirst edits:\\n%s\\nsecond edits:\\n%s\",\n\t\txlabel, ylabel, path, xdiff, ydiff)\n}\n","sourceCodeStart":286,"sourceCodeEnd":307,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/result/processors/fixer.go#L286-L307","documentation":"Two issue fixers produced overlapping (conflicting) text edits for the same region of the same file. When the diff3-style merge detects the overlap between the two edit sets, golangci-lint refuses to apply them and reports both edits with unified diffs. This is a deliberate safety check so the fixer never silently corrupts code.","triggerScenarios":"Running golangci-lint --fix where two enabled linters (e.g. gofmt/gofumpt plus goimports or similar) both want to rewrite overlapping lines of one file, and their edits intersect in the xedits/yedits merge.","commonSituations":"Enabling multiple formatting linters with overlapping scopes in .golangci.yml (e.g. gofmt + gofumpt + goimports + gci misconfigured); a custom plugin fixer overlapping built-in fixers.","solutions":["Disable one of the overlapping linters/fixers named in the message (xlabel/ylabel)","Apply one fixer's fix first (run golangci-lint --fix, resolve, run again) so edits no longer overlap","Adjust configuration so each formatting concern is owned by a single linter","If a third-party plugin is involved, update it or report the overlapping edit to its maintainers"],"exampleFix":"// before (.golangci.yml)\nlinters:\n  enable: [gofmt, gofumpt, goimports]\n// after\nlinters:\n  enable: [gofumpt, goimports]","handlingStrategy":"validation","validationCode":"cfg := parseGolangciConfig(\".golangci.yml\")\nformatFixers := []string{\"gofmt\", \"gofumpt\", \"goimports\", \"gci\"}\nvar enabled []string\nfor _, f := range formatFixers {\n    if cfg.Linters.Enable[f] { enabled = append(enabled, f) }\n}\nif len(enabled) > 1 {\n    return fmt.Errorf(\"overlapping fixers enabled: %v\", enabled)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable only one code-formatting linter that owns each concern","Run --fix iteratively and commit between runs when adding new linters","Audit custom plugin fixers for overlapping edit regions","Read the xlabel/ylabel in the message to see exactly which two fixers clashed"],"tags":["golangci-lint","auto-fix","conflict","linters"],"backgroundTag":"conflicting-fix-edits","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}