go-delve/delve · error

could not find %q in debug-info-directories

Error message

could not find %q in debug-info-directories

What it means

Returned by configureSetDebugInfoDirectories when the user runs `config debug-info-directories remove <dir>` and the given directory is not present in t.conf.DebugInfoDirectories. Delve only removes entries by exact string match from the configured list of directories searched for split DWARF debug info.

Source

Thrown at pkg/terminal/config.go:181

	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:
		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. Run `config debug-info-directories` with no argument to list current entries
  2. Use the exact stored string, including trailing slash if present
  3. Re-add the directory with `config debug-info-directories add <dir>` if you intended to add rather than remove

Example fix

// before
dlv> config debug-info-directories remove /usr/lib/debug/   # fails: stored as /usr/lib/debug
// after
dlv> config debug-info-directories                          # list
dlv> config debug-info-directories remove /usr/lib/debug    # exact match
Defensive patterns

Strategy: validation

Validate before calling

dirs = t.conf.DebugInfoDirectories
if target_dir not in dirs:
    raise ValueError("%r not in debug-info-directories: %r" % (target_dir, dirs))

Prevention

When it happens

Trigger: `config debug-info-directories remove /some/dir` where /some/dir was never added, was already removed, or differs textually (trailing slash, ~ unexpanded, relative path) from the stored entry.

Common situations: Cleaning up default debug-info directories (e.g. /usr/lib/debug) that were never added, typos, or shell paths with `~` that Delve stored unexpanded.

Related errors


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