{"record":{"id":"1e10c9614a7ca375","repo":"golangci/golangci-lint","slug":"update-plugin-file-w","errorCode":null,"errorMessage":"update plugin file: %w","messagePattern":"update plugin file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/internal/builder.go","lineNumber":55,"sourceCode":"\t\troot: root,\n\t\trepo: filepath.Join(root, \"golangci-lint\"),\n\t}\n}\n\n// Build builds the custom binary.\nfunc (b Builder) Build(ctx context.Context) error {\n\tb.log.Infof(\"Cloning golangci-lint repository\")\n\n\terr := b.clone(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"clone golangci-lint: %w\", err)\n\t}\n\n\tb.log.Infof(\"Adding plugin imports\")\n\n\terr = b.updatePluginsFile()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"update plugin file: %w\", err)\n\t}\n\n\tb.log.Infof(\"Adding replace directives\")\n\n\terr = b.addToGoMod(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"add to go.mod: %w\", err)\n\t}\n\n\tb.log.Infof(\"Running go mod tidy\")\n\n\terr = b.goModTidy(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"go mod tidy: %w\", err)\n\t}\n\n\tb.log.Infof(\"Building golangci-lint binary\")\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/commands/internal/builder.go#L37-L73","documentation":"Builder.Build, after cloning, rewrites the plugins file to add imports of the user's custom plugin modules. Failure of b.updatePluginsFile() is wrapped as \"update plugin file: %w\" — the plugin manifest in the cloned tree couldn't be read or modified.","triggerScenarios":"Running `golangci-lint custom` when updatePluginsFile fails: the cloned tree's plugins file is missing/unexpected (version mismatch with the expected layout), a plugin entry in .custom-gcl.yml is malformed, or the temp dir is not writable.","commonSituations":"Plugin entries in .custom-gcl.yml lacking a valid module path; building a golangci-lint version whose internal file layout the builder doesn't expect; disk/permission issues in the temp directory.","solutions":["Read the wrapped cause to see whether a plugin entry or the repo file layout is the problem.","Validate every plugin entry in .custom-gcl.yml has a correct module path and version.","Use a golangci-lint version compatible with your golangci-lint custom builder version.","Check the temp directory is writable and has enough disk space, then re-run."],"exampleFix":"// before (.custom-gcl.yml)\nplugins:\n  myplugin:      # missing module spec\n// after\nplugins:\n  myplugin:\n    module: example.com/myplugin\n    version: v1.0.0","handlingStrategy":"validation","validationCode":"// validate .custom-gcl.yml plugin entries before building\ntype plugin struct{ Module, Version string }\nfor name, p := range cfg.Plugins {\n  if p.Module == \"\" || p.Version == \"\" {\n    return fmt.Errorf(\"plugin %q needs both module and version\", name)\n  }\n}\n// temp dir must be writable\ntmp, err := os.MkdirTemp(\"\", \"golangci-custom\")\nif err != nil { return err }\ndefer os.RemoveAll(tmp)","typeGuard":null,"tryCatchPattern":"if err := customCmd.Run(); err != nil {\n  if strings.Contains(err.Error(), \"update plugin file\") {\n    log.Fatalf(\"check plugin entries and builder/version compatibility: %v\", errors.Unwrap(err))\n  }\n  return err\n}","preventionTips":["Give every plugin a full module path and version in .custom-gcl.yml.","Match the custom builder version with the target golangci-lint version's file layout.","Ensure temp/workspace dirs are writable with adequate disk space.","Add one plugin at a time so failures isolate to the offending entry."],"tags":["golangci-lint","plugins","custom-binary"],"backgroundTag":"invalid-plugin-config","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}