{"record":{"id":"058d6de27905cc63","repo":"golangci/golangci-lint","slug":"error-creating-path-relativity-processor-w","errorCode":null,"errorMessage":"error creating path relativity processor: %w","messagePattern":"error creating path relativity processor: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/lint/runner.go","lineNumber":42,"sourceCode":"type processorStat struct {\n\tinCount  int\n\toutCount int\n}\n\ntype Runner struct {\n\tLog logutils.Log\n\n\tlintCtx    *linter.Context\n\tProcessors []processors.Processor\n}\n\nfunc NewRunner(log logutils.Log, cfg *config.Config, goenv *goutil.Env,\n\tlineCache *fsutils.LineCache, fileCache *fsutils.FileCache,\n\tdbManager *lintersdb.Manager, lintCtx *linter.Context,\n) (*Runner, error) {\n\tpathRelativity, err := processors.NewPathRelativity(log, cfg.GetBasePath())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating path relativity processor: %w\", err)\n\t}\n\n\texclusionPaths, err := processors.NewExclusionPaths(log, &cfg.Linters.Exclusions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tenabledLinters, err := dbManager.GetEnabledLintersMap()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get enabled linters: %w\", err)\n\t}\n\n\tvar enabledFormatters []string\n\tfor name := range maps.Keys(enabledLinters) {\n\t\tif goformatters.IsFormatter(name) {\n\t\t\tenabledFormatters = append(enabledFormatters, name)\n\t\t}\n\t}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/lint/runner.go#L24-L60","documentation":"NewRunner constructs the processor chain; the first processor, NewPathRelativity (which converts absolute paths to paths relative to the configured base path), can fail if the base path configuration is invalid. The error is wrapped as \"error creating path relativity processor\", aborting runner creation before any linting happens.","triggerScenarios":"Calling NewRunner with a config whose cfg.GetBasePath() resolves to a path the processor cannot handle (e.g. a path that does not exist, or invalid output-path/relative-path-mode settings producing a bad base path).","commonSituations":"Setting `run.relative-path-mode` or output path options to unusual values; running inside containers/CI where the working directory differs from the configured base path; custom builds passing a wrong cfg.","solutions":["Check `run.relative-path-mode` and path-related settings in .golangci.yml; reset them to defaults (`relative-path-mode: gomod`) to test","Ensure the working directory where golangci-lint runs exists and is the module root","Remove custom base-path/output configuration and add back incrementally until the failure reappears","Inspect the wrapped %w cause — it names the exact filesystem/validation failure"],"exampleFix":"// before (.golangci.yml)\nrun:\n  relative-path-mode: custom-invalid-value\n// after\nrun:\n  relative-path-mode: gomod","handlingStrategy":"validation","validationCode":"// Validate path settings before running:\n// grep -E 'relative-path-mode|output' .golangci.yml\n// test -d . || exit 1   # ensure working dir exists\n// golangci-lint config verify || exit 1","typeGuard":null,"tryCatchPattern":"if err := processors.NewPathRelativity(log, basePath); err != nil {\n    return fmt.Errorf(\"error creating path relativity processor: %w\", err)\n}","preventionTips":["Keep `run.relative-path-mode` at documented values (gomod, gitroot, cfg, wd)","Run golangci-lint from an existing directory; never from a deleted cwd","Test container/CI path setups locally before merging CI changes","Run `golangci-lint config verify` whenever you touch path/output settings"],"tags":["golangci-lint","configuration","processors"],"backgroundTag":"invalid-base-path","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}