{"record":{"id":"f0c4c583ac01eb7f","repo":"golangci/golangci-lint","slug":"configuration-file-not-found","errorCode":null,"errorMessage":"configuration file not found","messagePattern":"configuration file not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/internal/configuration.go","lineNumber":135,"sourceCode":"\nfunc findConfigurationFile() (string, error) {\n\tentries, err := os.ReadDir(\".\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"read directory: %w\", err)\n\t}\n\n\tfor _, entry := range entries {\n\t\text := filepath.Ext(entry.Name())\n\n\t\tswitch strings.ToLower(strings.TrimPrefix(ext, \".\")) {\n\t\tcase \"yml\", \"yaml\", \"json\":\n\t\t\tif isConf(ext, entry.Name()) {\n\t\t\t\treturn entry.Name(), nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"configuration file not found\")\n}\n\nfunc isConf(ext, name string) bool {\n\treturn base+ext == name\n}\n","sourceCodeStart":117,"sourceCodeEnd":141,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/commands/internal/configuration.go#L117-L141","documentation":"`findConfigurationFile` (pkg/commands/internal/configuration.go:135) scans the current directory for a file named `.custom-gcl.yml`, `.custom-gcl.yaml`, or `.custom-gcl.json` (exact base name `.custom-gcl` plus a supported extension, checked by `isConf`). If none exists it returns this error, which `LoadConfiguration` wraps as `file  not found: configuration file not found`. Unlike golangci-lint itself, the custom builder does not search parent directories or other config names.","triggerScenarios":"Running the custom golangci-lint build command from a directory that contains no `.custom-gcl.{yml,yaml,json}` file — e.g. running it in a subdirectory or repo root when the config lives elsewhere.","commonSituations":"Running the command from the wrong working directory; naming the file `.custom-gcl.yaml.dist`, `custom-gcl.yml` (missing leading dot), or `.custom.gcl.yml` — `isConf` requires the exact name; the config only exists in a parent directory since there is no upward search.","solutions":["Create a `.custom-gcl.yml` file in the directory where you run the command, with `version` and `plugins` fields","cd to the directory that actually contains the `.custom-gcl.*` file before running the build","Check the exact file name — it must start with a dot and be exactly `.custom-gcl` + .yml/.yaml/.json (no other suffixes)"],"exampleFix":"# wrong: custom-gcl.yml (no leading dot) — not found\n# after\nmv custom-gcl.yml .custom-gcl.yml","handlingStrategy":"validation","validationCode":"const base = \".custom-gcl\"\nfound := false\nfor _, ext := range []string{\".yml\", \".yaml\", \".json\"} {\n\tif _, err := os.Stat(base + ext); err == nil {\n\t\tfound = true\n\t\tbreak\n\t}\n}\nif !found {\n\tlog.Fatal(\"no .custom-gcl.{yml,yaml,json} in current directory\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run custom-gcl commands from the directory containing the .custom-gcl.* file","Use the exact name `.custom-gcl.yml` (leading dot, no extra suffixes)","Remember there is no parent-directory search, unlike .golangci.yml"],"tags":["custom-gcl","config","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}