wavetermdev/waveterm · error

command not implemented %q

Error message

command not implemented %q

What it means

After the command is declared, serverImplAdapter uses reflection (findCmdMethod) to find a method named <command>command (case-insensitive) on the registered implementation. If no such method exists, it sends this error, optionally also emitting an out-of-band debug message when no response was expected. It means the command is known but this particular implementation object does not handle it.

Source

Thrown at pkg/wshutil/wshadapter.go:97

	rtype := reflect.TypeOf(impl)
	if rtype.Kind() != reflect.Ptr && rtype.Elem().Kind() != reflect.Struct {
		panic(fmt.Sprintf("expected struct pointer, got %s", rtype))
	}
	// returns isAsync
	return func(handler *RpcResponseHandler) bool {
		cmd := handler.GetCommand()
		methodDecl := WshCommandDeclMap[cmd]
		if methodDecl == nil {
			handler.SendResponseError(fmt.Errorf("command %q not found", cmd))
			return true
		}
		rmethod := findCmdMethod(impl, cmd)
		if rmethod == nil {
			if !handler.NeedsResponse() && cmd != wshrpc.Command_Message {
				// we also send an out of band message here since this is likely unexpected and will require debugging
				handler.SendMessage(fmt.Sprintf("command %q method %q not found", handler.GetCommand(), methodDecl.MethodName))
			}
			handler.SendResponseError(fmt.Errorf("command not implemented %q", cmd))
			return true
		}
		implMethod := reflect.ValueOf(impl).MethodByName(rmethod.Name)
		var callParams []reflect.Value
		callParams = append(callParams, reflect.ValueOf(handler.Context()))
		commandDataTypes := methodDecl.GetCommandDataTypes()
		if len(commandDataTypes) == 1 {
			cmdData, err := recodeCommandData(cmd, handler.GetCommandRawData(), commandDataTypes[0])
			if err != nil {
				handler.SendResponseError(err)
				return true
			}
			callParams = append(callParams, reflect.ValueOf(cmdData))
		} else if len(commandDataTypes) > 1 {
			multiArgAny, err := recodeCommandData(cmd, handler.GetCommandRawData(), multiArgRType)
			if err != nil {
				handler.SendResponseError(err)
				return true

View on GitHub (pinned to a4447c1563)

Solutions

  1. Add the missing method to your implementation struct, named <CommandName>Command (e.g. command 'wsl' requires method WslCommand) with the accepted signature (ctx, data) (response, error).
  2. Verify you registered the correct implementation object for this route — a different struct may own this command.
  3. Check method name spelling/casing; findCmdMethod matches strings.ToLower(method.Name) against cmd+"command".

Example fix

// before: impl missing handler for command 'wsl'
type ControllerImpl struct{}
// after: add the method following the naming convention
type ControllerImpl struct{}
func (c *ControllerImpl) WslCommand(ctx context.Context, data wshrpc.CommandWslData) (wshrpc.WslInfo, error) { ... }
Defensive patterns

Strategy: validation

Validate before calling

// Before registering an impl, confirm every declared command has a method:
for cmd := range commandsYouClaim {
    if wshutil.findCmdMethod(impl, cmd) == nil {
        return fmt.Errorf("impl %T missing method for command %q", impl, cmd)
    }
}

Type guard

func implementsCommand(impl any, cmd string) bool {
    m := reflect.TypeOf(impl)
    _, ok := m.MethodByName(strings.ToUpper(cmd[:1]) + cmd[1:] + "Command")
    return ok
}

Try / catch

err := client.SendRpcRequest(ctx, cmd, data)
if err != nil && strings.Contains(err.Error(), "command not implemented") {
    return fmt.Errorf("route does not handle %s; is the right impl registered?", cmd)
}

Prevention

When it happens

Trigger: Registering an implementation struct with serverImplAdapter that lacks the required method for a declared command; calling a command on a route whose implementation only implements a subset of commands; Message commands that fire-and-forget to an impl missing the handler.

Common situations: Partial implementation of an interface during development; renaming a Go method so the <cmd>command naming convention breaks; calling a UI-only or server-only command across domains.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/ff9d63f20370f304. Report an issue: GitHub.