go-delve/delve · error

wrong argument to "config debug-info-directories"

Error message

wrong argument to "config debug-info-directories"

What it means

Thrown by configureSetDebugInfoDirectories when the first argument is not one of the recognized operations `-clear`, `-add`, or `-rm`. The command's switch statement hits its default branch because the operation name is misspelled or an unsupported value was passed.

Source

Thrown at pkg/terminal/config.go:184

		}
		t.conf.DebugInfoDirectories = append(t.conf.DebugInfoDirectories, v[1])
	case "-rm":
		if len(v) < 2 {
			return errors.New("not enough arguments to \"config debug-info-directories\"")
		}
		found := false
		for i := range t.conf.DebugInfoDirectories {
			if t.conf.DebugInfoDirectories[i] == v[1] {
				found = true
				t.conf.DebugInfoDirectories = append(t.conf.DebugInfoDirectories[:i], t.conf.DebugInfoDirectories[i+1:]...)
				break
			}
		}
		if !found {
			return fmt.Errorf("could not find %q in debug-info-directories", v[1])
		}
	default:
		return errors.New("wrong argument to \"config debug-info-directories\"")
	}

	if t.client != nil {
		t.client.SetDebugInfoDirectories(t.conf.DebugInfoDirectories)
	}
	return nil
}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Use the exact flags: `-clear`, `-add <dir>`, or `-rm <dir>`, each with a single leading dash.
  2. Fix case sensitivity: `-add` not `-Add`.
  3. To view directories, run `config debug-info-directories` with no arguments rather than guessing a `-list` flag.

Example fix

// before
config debug-info-directories --add /usr/local/go/src
// after
config debug-info-directories -add /usr/local/go/src
Defensive patterns

Strategy: validation

Validate before calling

allowed := map[string]bool{"-clear": true, "-add": true, "-rm": true}
if !allowed[op] {
    return fmt.Errorf("unknown op %q; use -clear, -add, or -rm", op)
}

Prevention

When it happens

Trigger: Running e.g. `config debug-info-directories --add /path` (double dash), `-Add` (wrong case), `add /path` (missing dash), or `-list` (not a supported subcommand).

Common situations: Users assuming GNU-style double-dash flags; expecting a listing/list subcommand; typos like `-ad` or `-remove`.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/41ecf4fc81db795a. Report an issue: GitHub.