{"record":{"id":"ff9d63f20370f304","repo":"wavetermdev/waveterm","slug":"command-not-implemented-q","errorCode":null,"errorMessage":"command not implemented %q","messagePattern":"command not implemented %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshutil/wshadapter.go","lineNumber":97,"sourceCode":"\trtype := reflect.TypeOf(impl)\n\tif rtype.Kind() != reflect.Ptr && rtype.Elem().Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"expected struct pointer, got %s\", rtype))\n\t}\n\t// returns isAsync\n\treturn func(handler *RpcResponseHandler) bool {\n\t\tcmd := handler.GetCommand()\n\t\tmethodDecl := WshCommandDeclMap[cmd]\n\t\tif methodDecl == nil {\n\t\t\thandler.SendResponseError(fmt.Errorf(\"command %q not found\", cmd))\n\t\t\treturn true\n\t\t}\n\t\trmethod := findCmdMethod(impl, cmd)\n\t\tif rmethod == nil {\n\t\t\tif !handler.NeedsResponse() && cmd != wshrpc.Command_Message {\n\t\t\t\t// we also send an out of band message here since this is likely unexpected and will require debugging\n\t\t\t\thandler.SendMessage(fmt.Sprintf(\"command %q method %q not found\", handler.GetCommand(), methodDecl.MethodName))\n\t\t\t}\n\t\t\thandler.SendResponseError(fmt.Errorf(\"command not implemented %q\", cmd))\n\t\t\treturn true\n\t\t}\n\t\timplMethod := reflect.ValueOf(impl).MethodByName(rmethod.Name)\n\t\tvar callParams []reflect.Value\n\t\tcallParams = append(callParams, reflect.ValueOf(handler.Context()))\n\t\tcommandDataTypes := methodDecl.GetCommandDataTypes()\n\t\tif len(commandDataTypes) == 1 {\n\t\t\tcmdData, err := recodeCommandData(cmd, handler.GetCommandRawData(), commandDataTypes[0])\n\t\t\tif err != nil {\n\t\t\t\thandler.SendResponseError(err)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tcallParams = append(callParams, reflect.ValueOf(cmdData))\n\t\t} else if len(commandDataTypes) > 1 {\n\t\t\tmultiArgAny, err := recodeCommandData(cmd, handler.GetCommandRawData(), multiArgRType)\n\t\t\tif err != nil {\n\t\t\t\thandler.SendResponseError(err)\n\t\t\t\treturn true","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshutil/wshadapter.go#L79-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Verify you registered the correct implementation object for this route — a different struct may own this command.","Check method name spelling/casing; findCmdMethod matches strings.ToLower(method.Name) against cmd+\"command\"."],"exampleFix":"// before: impl missing handler for command 'wsl'\ntype ControllerImpl struct{}\n// after: add the method following the naming convention\ntype ControllerImpl struct{}\nfunc (c *ControllerImpl) WslCommand(ctx context.Context, data wshrpc.CommandWslData) (wshrpc.WslInfo, error) { ... }","handlingStrategy":"validation","validationCode":"// Before registering an impl, confirm every declared command has a method:\nfor cmd := range commandsYouClaim {\n    if wshutil.findCmdMethod(impl, cmd) == nil {\n        return fmt.Errorf(\"impl %T missing method for command %q\", impl, cmd)\n    }\n}","typeGuard":"func implementsCommand(impl any, cmd string) bool {\n    m := reflect.TypeOf(impl)\n    _, ok := m.MethodByName(strings.ToUpper(cmd[:1]) + cmd[1:] + \"Command\")\n    return ok\n}","tryCatchPattern":"err := client.SendRpcRequest(ctx, cmd, data)\nif err != nil && strings.Contains(err.Error(), \"command not implemented\") {\n    return fmt.Errorf(\"route does not handle %s; is the right impl registered?\", cmd)\n}","preventionTips":["Follow the <CommandName>Command method naming convention exactly.","Implement the full wshrpc interface for any struct passed to serverImplAdapter.","Register each implementation on the route that actually owns its commands."],"tags":["rpc","wsh","reflection","not-implemented","waveterm"],"backgroundTag":"rpc-handler-method-missing","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}