go-delve/delve · error

command not available

Error message

command not available

What it means

errNoCmd is the sentinel error for the DAP-side REPL command dispatcher: it is returned when the requested command alias does not match any entry in debugCommands(). noCmdAvailable, help, delveCmd, and helpMessage all surface it.

Source

Thrown at service/dap/command.go:128

    x -fmt hex -count 20 -size 1 0xc00008af38
    x -fmt hex -count 20 -size 1 -x 0xc00008af38 + 8
    x -fmt hex -count 20 -size 1 -x &myVar
    x -fmt hex -count 20 -size 1 -x myPtrVar`
)

// debugCommands returns a list of commands with default commands defined.
func debugCommands(s *Session) []command {
	return []command{
		{aliases: []string{"help", "h"}, cmdFn: s.helpMessage, helpMsg: msgHelp},
		{aliases: []string{"config"}, cmdFn: s.evaluateConfig, helpMsg: msgConfig},
		{aliases: []string{"sources", "s"}, cmdFn: s.sources, helpMsg: msgSources},
		{aliases: []string{"target"}, cmdFn: s.targetCmd, helpMsg: msgTarget},
		{aliases: []string{"examinemem", "x"}, cmdFn: s.examineMemory, helpMsg: msgExamineMemory},
	}
}

var errNoCmd = errors.New("command not available")

func (s *Session) helpMessage(_, _ int, args string) (string, error) {
	var buf bytes.Buffer
	if args != "" {
		for _, cmd := range debugCommands(s) {
			if slices.Contains(cmd.aliases, args) {
				return cmd.helpMsg, nil
			}
		}
		return "", errNoCmd
	}

	fmt.Fprintln(&buf, "The following commands are available:")

	for _, cmd := range debugCommands(s) {
		h := cmd.helpMsg
		if idx := strings.Index(h, "\n"); idx >= 0 {
			h = h[:idx]

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Run `help` (or `help <cmd>`) through the DAP REPL to list available commands
  2. Check spelling/aliases of the command (e.g. `examinemem` or `x`, `sources` or `s`)
  3. Update client automation to commands supported in the current Delve version
Defensive patterns

Strategy: try-catch

Validate before calling

knownCmds := map[string]bool{"x": true, "examinemem": true, "sources": true, "target": true /* ... */}
if !knownCmds[cmd] { /* show help instead of dispatching */ }

Try / catch

out, err := evalREPL(ctx, cmd)
if err != nil && strings.Contains(err.Error(), "command not available") {
	out, _ = evalREPL(ctx, "help")
}

Prevention

When it happens

Trigger: Sending an unknown command name through the DAP REPL evaluation (e.g. a typo like `breakpoin` or a CLI-only command not present in the DAP command set), or `help <unknown-topic>`.

Common situations: Clients reusing terminal-frontend command names that the DAP layer does not implement; version drift where a command was renamed/removed; typos in automation scripts driving the console.

Related errors


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