{"record":{"id":"a694149157f79102","repo":"go-delve/delve","slug":"wrong-number-of-arguments-to-config","errorCode":null,"errorMessage":"wrong number of arguments to \"config\"","messagePattern":"wrong number of arguments to \"config\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/config.go","lineNumber":21,"sourceCode":"import (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"text/tabwriter\"\n\n\t\"github.com/go-delve/delve/pkg/config\"\n)\n\nfunc configureCmd(t *Term, ctx callContext, args string) error {\n\tt.substitutePathRulesCache = nil\n\tswitch args {\n\tcase \"-list\":\n\t\treturn configureList(t)\n\tcase \"-save\":\n\t\treturn config.SaveConfig(t.conf)\n\tcase \"\":\n\t\treturn errors.New(\"wrong number of arguments to \\\"config\\\"\")\n\tdefault:\n\t\terr := configureSet(t, args)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif t.client != nil { // only happens in tests\n\t\t\tlcfg := t.loadConfig()\n\t\t\tt.client.SetReturnValuesLoadConfig(&lcfg)\n\t\t\tt.updateConfig()\n\t\t}\n\t\treturn nil\n\t}\n}\n\nfunc configureList(t *Term) error {\n\tw := new(tabwriter.Writer)\n\tw.Init(t.stdout, 0, 8, 1, ' ', 0)\n\tconfig.ConfigureList(w, t.conf, \"yaml\")","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/config.go#L3-L39","documentation":"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).","triggerScenarios":"Running 'config' with no arguments at all in the terminal (or via the test path assertNoErrorConfigureCmd/TestConfig where args is empty).","commonSituations":"Users typing 'config' expecting an interactive listing, unaware that listing requires 'config -list'; or empty arguments after shell quoting strips content.","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."],"exampleFix":"// before\nconfig\n// after\nconfig -list","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(args) == \"\" { return errors.New(\"config requires -list, -save, or '<key> <value>'\") }","typeGuard":"func validConfigArgs(args string) bool {\n    switch strings.TrimSpace(args) {\n    case \"\", \"-list\", \"-save\":\n        return strings.TrimSpace(args) != \"\"\n    }\n    return strings.Contains(strings.TrimSpace(args), \" \") // key value pair\n}","tryCatchPattern":"// wrapping configureCmd in tests\nif err := configureCmd(t, ctx, args); err != nil {\n    t.Fatalf(\"config %q failed: %v\", args, err)\n}","preventionTips":["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."],"tags":["cli","argument-validation","delve","config"],"backgroundTag":"invalid-command-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}