egametang/ET · error · Exception

RemoveRobot error!

Error message

RemoveRobot error!

What it means

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.

Source

Thrown at Packages/cn.etetet.robot/Scripts/Hotfix/Server/RemoveRobotConsoleHandler.cs:26

    public class RemoveRobotConsoleHandler: IConsoleHandler
    {
        public async ETTask Run(Fiber fiber, ModeContex contex, string content)
        {
            EntityRef<ModeContex> contexRef = contex;
            try
            {
                switch (content)
                {
                    case ConsoleMode.RemoveRobot:
                    {
                        Log.Console("RemoveRobot args error!");
                        break;
                    }
                    default:
                    {
                        RemoveRobotArgs options = null;
                        Parser.Default.ParseArguments<RemoveRobotArgs>(content.Split(' '))
                                .WithNotParsed(error => throw new Exception($"RemoveRobot error!"))
                                .WithParsed(o => { options = o; });

                        RobotManagerComponent robotManagerComponent = fiber.Root.GetComponent<RobotManagerComponent>();
                        if (robotManagerComponent == null)
                        {
                            Log.Console("RobotManagerComponent not found!");
                            return;
                        }
                        robotManagerComponent.GetRobotActorId(options.Account, out ActorId actorId);
                        ProcessInnerSender processInnerSender = fiber.Root.GetComponent<ProcessInnerSender>();
                        Console2Robot_LogoutRequest request = Console2Robot_LogoutRequest.Create();
                        Console2Robot_LogoutResponse response = await processInnerSender.Call(actorId.FiberInstanceId, request) as Console2Robot_LogoutResponse;
                        Log.Console($"Remove Robot OK: {options.Account}");
                        break;
                    }
                }
            }
            finally

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Invoke 'RemoveRobot' bare to see usage help.
  2. Inspect RemoveRobotArgs to learn required flags (likely --account).
  3. Re-issue with correctly typed arguments.
  4. Improve the handler to include parser errors in the message.

Example fix

// before: discards parse errors
.WithNotParsed(error => throw new Exception($"RemoveRobot error!"))
// after: include real errors
.WithNotParsed(error => throw new Exception($"RemoveRobot error: {string.Join(", ", error)}"))
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate required fields up front
if (string.IsNullOrWhiteSpace(account)) {
    Log.Console("Usage: RemoveRobot --account <name>");
    return;
}

Try / catch

try { /* parse + remove */ }
catch (Exception e) when (e.Message.Contains("RemoveRobot error")) {
    Log.Console($"Invalid RemoveRobot arguments. Usage: RemoveRobot --account <name>. Detail: {e.Message}");
}

Prevention

When it happens

Trigger: Issuing 'RemoveRobot' with arguments that fail to bind to RemoveRobotArgs (e.g. missing --account, wrong type). WithNotParsed throws generically without the underlying error.

Common situations: Malformed RemoveRobot console input; RemoveRobotArgs schema changed (new required field); calling the command without the expected --account flag.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/1be914ee96aee68d. Report an issue: GitHub.