golangci/golangci-lint · error
invalid params:%s
Error message
invalid params:%s
What it means
The gci formatter's section parser converts configured import-section strings into section objects. When any provided section name is not recognized (stdlib, default, prefix(...), localModule, etc.), it collects them and returns 'invalid params: <names>'. Thrown by Parse during gci configuration.
Source
Thrown at pkg/goformatters/gci/internal/section/parser.go:48
} else if strings.HasPrefix(s, "prefix(") && len(d) > 8 {
list = append(list, section.Custom{Prefix: d[7 : len(d)-1]})
} else if strings.HasPrefix(s, "commentline(") && len(d) > 13 {
list = append(list, section.Custom{Prefix: d[12 : len(d)-1]})
} else if s == "dot" {
list = append(list, section.Dot{})
} else if s == "blank" {
list = append(list, section.Blank{})
} else if s == "alias" {
list = append(list, section.Alias{})
} else if s == "localmodule" {
// pointer because we need to mutate the section at configuration time
list = append(list, §ion.LocalModule{})
} else {
errString += fmt.Sprintf(" %s", s)
}
}
if errString != "" {
return nil, errors.New(fmt.Sprintf("invalid params:%s", errString))
}
return list, nil
}
View on GitHub (pinned to ed7a235d2d)
Solutions
- Read the error text; it appends each unrecognized section name — fix or remove them
- Use only valid gci sections: standard, default, prefix(path), localModule, blank, dot
- Check gci/golangci-lint version compatibility and adjust section syntax accordingly
- Run the gci CLI directly ('gci diff --section ...') to validate sections before committing config
Example fix
// before (.golangci.yml)
linters-settings:
gci:
sections:
- standard
- localmodule
// after
linters-settings:
gci:
sections:
- standard
- default
- localModule Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"standard": true, "default": true, "localModule": true, "blank": true, "dot": true}
for _, s := range cfg.Gci.Sections {
if !valid[s] && !strings.HasPrefix(s, "prefix(") {
return fmt.Errorf("unknown gci section %q", s)
}
} Prevention
- Use only documented gci section names, minding exact casing (localModule)
- Test section config with the gci CLI before committing
- Keep gci settings matched to your golangci-lint version
When it happens
Trigger: gci linter-settings 'sections' contains an unknown/misspelled section token, e.g. sections: [standard, localmodule] (wrong case) or prefix( missing closing paren in older versions.
Common situations: Typos in section names; using docs for a different gci version whose accepted section set differs; copying sections from other import-grouping tools; case-sensitivity mistakes (LocalModule vs localModule).
Related errors
- the configuration contains invalid elements
- root field 'version' is required
- no plugins defined
- field 'module' is required
- missing information: 'version' or 'path' should be provided
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/d294a6598e50b4d7.
Report an issue: GitHub.