go-delve/delve · error
wrong number of arguments to "config"
Error message
wrong number of arguments to "config"
What it means
configureCmd handles the 'config' terminal command. It accepts '-list', '-save', or a '<key> <value>' assignment handled by configureSet. An empty argument matches none of these and yields 'wrong number of arguments to "config"', since bare 'config' is not a supported form (use 'config -list' to see settings).
Source
Thrown at pkg/terminal/config.go:21
import (
"errors"
"fmt"
"reflect"
"strings"
"text/tabwriter"
"github.com/go-delve/delve/pkg/config"
)
func configureCmd(t *Term, ctx callContext, args string) error {
t.substitutePathRulesCache = nil
switch args {
case "-list":
return configureList(t)
case "-save":
return config.SaveConfig(t.conf)
case "":
return errors.New("wrong number of arguments to \"config\"")
default:
err := configureSet(t, args)
if err != nil {
return err
}
if t.client != nil { // only happens in tests
lcfg := t.loadConfig()
t.client.SetReturnValuesLoadConfig(&lcfg)
t.updateConfig()
}
return nil
}
}
func configureList(t *Term) error {
w := new(tabwriter.Writer)
w.Init(t.stdout, 0, 8, 1, ' ', 0)
config.ConfigureList(w, t.conf, "yaml")View on GitHub (pinned to a23773e6c3)
Solutions
- Use 'config -list' to show current configuration.
- Use 'config -save' to persist the configuration.
- Set a value with 'config <key> <value>', e.g. 'config max-string-len 200'.
- Run 'help config' for the exact syntax.
Example fix
// before config // after config -list
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(args) == "" { return errors.New("config requires -list, -save, or '<key> <value>'") } Type guard
func validConfigArgs(args string) bool {
switch strings.TrimSpace(args) {
case "", "-list", "-save":
return strings.TrimSpace(args) != ""
}
return strings.Contains(strings.TrimSpace(args), " ") // key value pair
} Try / catch
// wrapping configureCmd in tests
if err := configureCmd(t, ctx, args); err != nil {
t.Fatalf("config %q failed: %v", args, err)
} Prevention
- Use 'config -list' instead of bare 'config' to view settings.
- Always pass a key and value together when setting, e.g. 'config substitute-path /a /b'.
- In tests, never invoke configureCmd with an empty args string; assert on the expected error or supply valid args.
When it happens
Trigger: Running 'config' with no arguments at all in the terminal (or via the test path assertNoErrorConfigureCmd/TestConfig where args is empty).
Common situations: Users typing 'config' expecting an interactive listing, unaware that listing requires 'config -list'; or empty arguments after shell quoting strips content.
Related errors
- clear-checkpoint argument must be a checkpoint ID
- too many arguments
- command not available
- unknown config parameter
- -o option specified with an output path
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/a694149157f79102.
Report an issue: GitHub.