{"record":{"id":"250f6825d28d1b39","repo":"golangci/golangci-lint","slug":"get-base-path-w","errorCode":null,"errorMessage":"get base path: %w","messagePattern":"get base path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/loader.go","lineNumber":114,"sourceCode":"\tif opts.CheckDeprecation {\n\t\terr = l.handleDeprecation()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tl.handleFormatterDeprecations()\n\t}\n\n\tl.handleGoVersion()\n\n\terr = goutil.CheckGoVersion(l.cfg.Run.Go)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tl.cfg.basePath, err = fsutils.GetBasePath(context.Background(), l.cfg.Run.RelativePathMode, l.cfg.cfgDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get base path: %w\", err)\n\t}\n\n\terr = l.handleEnableOnlyOption()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif opts.Validation {\n\t\terr = l.cfg.Validate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// Hack to append values from StringSlice flags.","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/loader.go#L96-L132","documentation":"Loader.Load computes the base path via fsutils.GetBasePath using run.relative-path-mode and the config directory; any failure is wrapped as 'get base path: %w'. The base path is needed to resolve relative paths in the config against the correct root.","triggerScenarios":"GetBasePath failing due to an invalid run.relative-path-mode value, an inaccessible cfgDir, or filesystem errors while resolving the working directory (e.g. deleted cwd).","commonSituations":"Setting run.relative-path-mode to an unsupported value; running the binary from a deleted working directory; container/CI environments where the config dir doesn't exist.","solutions":["Read the wrapped inner error for the root cause","Set run.relative-path-mode to a valid value (e.g. cfg, gomod, gitroot, subdir) or remove it to use the default","Ensure the config directory and working directory exist and are accessible"],"exampleFix":"# before\nrun:\n  relative-path-mode: bogus-mode\n# after\nrun:\n  relative-path-mode: gomod","handlingStrategy":"validation","validationCode":"switch cfg.Run.RelativePathMode {\ncase \"\", \"cfg\", \"gomod\", \"gitroot\", \"subdir\", \"wd\":\n\t// ok\ndefault:\n\treturn fmt.Errorf(\"unsupported relative-path-mode: %s\", cfg.Run.RelativePathMode)\n}","typeGuard":null,"tryCatchPattern":"if err := loader.Load(ctx); err != nil {\n\tif strings.HasPrefix(err.Error(), \"get base path:\") {\n\t\tlog.Fatalf(\"base path resolution failed: %v\", err)\n\t}\n}","preventionTips":["Use only documented relative-path-mode values","Ensure cwd and config dir exist before launching (esp. in containers)","Prefer the default mode unless you need explicit path resolution"],"tags":["golangci-lint","config-loading","filesystem"],"backgroundTag":"invalid-base-path","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}