go-delve/delve · error

not enough arguments to "config debug-info-directories"

Error message

not enough arguments to "config debug-info-directories"

What it means

Thrown by configureSetDebugInfoDirectories when the `-add` operation is used without a directory argument. Split2PartsBySpace produced fewer than two tokens, so there is no directory to append to DebugInfoDirectories. It is a strict argument-count guard before mutating the configuration.

Source

Thrown at pkg/terminal/config.go:165

	return nil
}

func configureSetDebugInfoDirectories(t *Term, rest string) error {
	v := config.Split2PartsBySpace(rest)

	if t.client != nil {
		did, err := t.client.GetDebugInfoDirectories()
		if err == nil {
			t.conf.DebugInfoDirectories = did
		}
	}

	switch v[0] {
	case "-clear":
		t.conf.DebugInfoDirectories = t.conf.DebugInfoDirectories[:0]
	case "-add":
		if len(v) < 2 {
			return errors.New("not enough arguments to \"config debug-info-directories\"")
		}
		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:

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Supply the directory: `config debug-info-directories -add /path/to/dir`.
  2. Quote paths containing spaces: `config debug-info-directories -add "/path with spaces"`.
  3. Use `config debug-info-directories` with no arguments to list the current directories and verify state.

Example fix

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

Strategy: validation

Validate before calling

v := config.Split2PartsBySpace(rest)
if v[0] == "-add" && len(v) < 2 {
    return errors.New("-add requires a directory argument")
}

Prevention

When it happens

Trigger: Running `config debug-info-directories -add` with no path following it in the Delve CLI (e.g. `config` line `debug-info-directories -add`).

Common situations: Users copy only the flag from documentation and forget the path; an editor or script truncates the line; paths are expected to be filled in by a variable that ends up empty.

Related errors


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