{"record":{"id":"1be914ee96aee68d","repo":"egametang/ET","slug":"removerobot-error","errorCode":null,"errorMessage":"RemoveRobot error!","messagePattern":"RemoveRobot error!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.robot/Scripts/Hotfix/Server/RemoveRobotConsoleHandler.cs","lineNumber":26,"sourceCode":"    public class RemoveRobotConsoleHandler: IConsoleHandler\n    {\n        public async ETTask Run(Fiber fiber, ModeContex contex, string content)\n        {\n            EntityRef<ModeContex> contexRef = contex;\n            try\n            {\n                switch (content)\n                {\n                    case ConsoleMode.RemoveRobot:\n                    {\n                        Log.Console(\"RemoveRobot args error!\");\n                        break;\n                    }\n                    default:\n                    {\n                        RemoveRobotArgs options = null;\n                        Parser.Default.ParseArguments<RemoveRobotArgs>(content.Split(' '))\n                                .WithNotParsed(error => throw new Exception($\"RemoveRobot error!\"))\n                                .WithParsed(o => { options = o; });\n\n                        RobotManagerComponent robotManagerComponent = fiber.Root.GetComponent<RobotManagerComponent>();\n                        if (robotManagerComponent == null)\n                        {\n                            Log.Console(\"RobotManagerComponent not found!\");\n                            return;\n                        }\n                        robotManagerComponent.GetRobotActorId(options.Account, out ActorId actorId);\n                        ProcessInnerSender processInnerSender = fiber.Root.GetComponent<ProcessInnerSender>();\n                        Console2Robot_LogoutRequest request = Console2Robot_LogoutRequest.Create();\n                        Console2Robot_LogoutResponse response = await processInnerSender.Call(actorId.FiberInstanceId, request) as Console2Robot_LogoutResponse;\n                        Log.Console($\"Remove Robot OK: {options.Account}\");\n                        break;\n                    }\n                }\n            }\n            finally","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.robot/Scripts/Hotfix/Server/RemoveRobotConsoleHandler.cs#L8-L44","documentation":"RemoveRobotConsoleHandler mirrors 315 for the RemoveRobot command: any WithNotParsed failure throws a generic 'RemoveRobot error!'. The empty-args case is handled separately and only logs.","triggerScenarios":"Issuing 'RemoveRobot' with arguments that fail to bind to RemoveRobotArgs (e.g. missing --account, wrong type). WithNotParsed throws generically without the underlying error.","commonSituations":"Malformed RemoveRobot console input; RemoveRobotArgs schema changed (new required field); calling the command without the expected --account flag.","solutions":["Invoke 'RemoveRobot' bare to see usage help.","Inspect RemoveRobotArgs to learn required flags (likely --account).","Re-issue with correctly typed arguments.","Improve the handler to include parser errors in the message."],"exampleFix":"// before: discards parse errors\n.WithNotParsed(error => throw new Exception($\"RemoveRobot error!\"))\n// after: include real errors\n.WithNotParsed(error => throw new Exception($\"RemoveRobot error: {string.Join(\", \", error)}\"))","handlingStrategy":"try-catch","validationCode":"// Validate required fields up front\nif (string.IsNullOrWhiteSpace(account)) {\n    Log.Console(\"Usage: RemoveRobot --account <name>\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try { /* parse + remove */ }\ncatch (Exception e) when (e.Message.Contains(\"RemoveRobot error\")) {\n    Log.Console($\"Invalid RemoveRobot arguments. Usage: RemoveRobot --account <name>. Detail: {e.Message}\");\n}","preventionTips":["Inspect RemoveRobotArgs for the exact required flags.","Include parser errors in the thrown message.","Document the console command format where operators can see it."],"tags":["robot","console","argument-parsing","commandlineparser"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}