golangci/golangci-lint · error
configuration file not found
Error message
configuration file not found
What it means
`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.
Source
Thrown at pkg/commands/internal/configuration.go:135
func findConfigurationFile() (string, error) {
entries, err := os.ReadDir(".")
if err != nil {
return "", fmt.Errorf("read directory: %w", err)
}
for _, entry := range entries {
ext := filepath.Ext(entry.Name())
switch strings.ToLower(strings.TrimPrefix(ext, ".")) {
case "yml", "yaml", "json":
if isConf(ext, entry.Name()) {
return entry.Name(), nil
}
}
}
return "", errors.New("configuration file not found")
}
func isConf(ext, name string) bool {
return base+ext == name
}
View on GitHub (pinned to ed7a235d2d)
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)
Example fix
# wrong: custom-gcl.yml (no leading dot) — not found # after mv custom-gcl.yml .custom-gcl.yml
Defensive patterns
Strategy: validation
Validate before calling
const base = ".custom-gcl"
found := false
for _, ext := range []string{".yml", ".yaml", ".json"} {
if _, err := os.Stat(base + ext); err == nil {
found = true
break
}
}
if !found {
log.Fatal("no .custom-gcl.{yml,yaml,json} in current directory")
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- root field 'version' is required
- no plugins defined
- field 'module' is required
- missing information: 'version' or 'path' should be provided
- invalid configuration: 'version' and 'path' should not be pr
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/f0c4c583ac01eb7f.
Report an issue: GitHub.