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, &section.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

  1. Read the error text; it appends each unrecognized section name — fix or remove them
  2. Use only valid gci sections: standard, default, prefix(path), localModule, blank, dot
  3. Check gci/golangci-lint version compatibility and adjust section syntax accordingly
  4. 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

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


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/d294a6598e50b4d7. Report an issue: GitHub.