go-delve/delve · error

command not available

Error message

command not available

What it means

errNoCmd is returned when a terminal command line does not match any registered Delve command. It is the sentinel error of noCmdAvailable, used as a fallback command handler and referenced by help/delve command plumbing.

Source

Thrown at pkg/terminal/command.go:754

// Merge takes aliases defined in the config struct and merges them with the default aliases.
func (c *Commands) Merge(allAliases map[string][]string) {
	for i := range c.cmds {
		if c.cmds[i].builtinAliases != nil {
			c.cmds[i].aliases = append(c.cmds[i].aliases[:0], c.cmds[i].builtinAliases...)
		}
	}
	for i := range c.cmds {
		if aliases, ok := allAliases[c.cmds[i].aliases[0]]; ok {
			if c.cmds[i].builtinAliases == nil {
				c.cmds[i].builtinAliases = make([]string, len(c.cmds[i].aliases))
				copy(c.cmds[i].builtinAliases, c.cmds[i].aliases)
			}
			c.cmds[i].aliases = append(c.cmds[i].aliases, aliases...)
		}
	}
}

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

func noCmdAvailable(t *Term, ctx callContext, args string) error {
	return errNoCmd
}

func nullCommand(t *Term, ctx callContext, args string) error {
	return nil
}

func (c *Commands) help(t *Term, ctx callContext, args string) error {
	if args != "" {
		if p1, p2, ok := strings.Cut(args, " "); ok && p1 == "config" {
			if !configureValidParameter(t, p2) {
				return errors.New("unknown config parameter")
			}
			if doc := config.Documentation[p2]; doc != "" {
				fmt.Fprintln(t.stdout, doc)
				return nil

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Run 'help' at the (dlv) prompt to list valid commands
  2. Check spelling of the command (e.g. 'breakpoints' vs 'breakpoint')
  3. Use command completion (Tab) to find the right command name
  4. Upgrade/downgrade Delve if a documented command is missing in your version

Example fix

// before
(dlv) brk main.go:10
// after
(dlv) break main.go:10
Defensive patterns

Strategy: validation

Validate before calling

// Validate command names before scripting noninteractive sessions
valid := map[string]bool{"break":true, "breakpoints":true, "continue":true, "print":true, "stack":true}
if !valid[cmd] {
    return fmt.Errorf("%q is not a dlv command; run 'help'", cmd)
}

Try / catch

err := term.ExecuteCommand(input)
if errors.Is(err, errNoCmd) {
    fmt.Fprintln(os.Stderr, "unknown command; try 'help' or Tab completion:", input)
}

Prevention

When it happens

Trigger: Typing an unrecognized command at the (dlv) prompt, e.g. 'breakpont main.go:10', or using a command that was removed/renamed in your Delve version.

Common situations: Typos at the interactive prompt; following outdated tutorials that reference renamed commands; scripting noninteractive sessions with mistyped commands.

Related errors


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