{"record":{"id":"1eb5a551ea839959","repo":"babalae/better-genshin-impact","slug":"action-1eb5a5","errorCode":null,"errorMessage":"未知的前置 action 类型","messagePattern":"未知的前置 action 类型","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoPathing/Handler/ActionFactory.cs","lineNumber":49,"sourceCode":"                \"exit_and_relogin\" => new ExitAndReloginHandler(),\n                \"wonderland_cycle\" => new EnterAndExitWonderlandHandler(),\n                \"set_time\" => new SetTimeHandler(),\n                \"use_gadget\" => new UseGadgetHandler(),\n                \"pick_up_collect\" => new PickUpCollectHandler(),\n                _ => throw new ArgumentException(\"未知的后置 action 类型\")\n            };\n        });\n    }\n\n    public static IActionHandler GetBeforeHandler(string handlerType)\n    {\n        return _handlers.GetOrAdd(handlerType, (key) =>\n        {\n            return key switch\n            {\n                \"up_down_grab_leaf\" => new UpDownGrabLeafHandler(),\n                \"stop_flying\" => new StopFlyingHandler(),\n                _ => throw new ArgumentException(\"未知的前置 action 类型\")\n            };\n        });\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":54,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoPathing/Handler/ActionFactory.cs#L31-L54","documentation":"Thrown by ActionFactory.GetBeforeHandler when the supplied action string is neither 'up_down_grab_leaf' nor 'stop_flying' — the only two registered before-action (前置 action) handlers.","triggerScenarios":"A pathing-task waypoint defines a before-action with a value outside {up_down_grab_leaf, stop_flying}, and GetBeforeHandler is called with it.","commonSituations":"Typo in the JSON before_action field; an unsupported before-action was authored; the before-action set was reduced in this build.","solutions":["Correct the before_action value to 'up_down_grab_leaf' or 'stop_flying'.","Remove the unsupported before-action from the waypoint if it isn't needed.","Update to a build that supports the action if it is a legitimate new type."],"exampleFix":"// before\nvar handler = ActionFactory.GetBeforeHandler(beforeAction);\n\n// after\nvar knownBefore = new[]{\"up_down_grab_leaf\",\"stop_flying\"};\nif (!knownBefore.Contains(beforeAction))\n{\n    throw new ArgumentException($\"未知的前置 action 类型: {beforeAction}. 支持的值: {string.Join(\", \", knownBefore)}\");\n}","handlingStrategy":"validation","validationCode":"var knownBefore = new[]{\"up_down_grab_leaf\",\"stop_flying\"};\nif (!knownBefore.Contains(beforeAction))\n{\n    throw new ArgumentException($\"未知的前置 action 类型: {beforeAction}\");\n}","typeGuard":"static readonly HashSet<string> KnownBeforeActions = new(){\"up_down_grab_leaf\",\"stop_flying\"};\nbool IsValidBeforeAction(string? a) => a is not null && KnownBeforeActions.Contains(a);","tryCatchPattern":null,"preventionTips":["Validate before_action values when loading pathing tasks.","Keep the known set in sync with ActionFactory registrations.","Use an authoring tool that restricts before-action choices."],"tags":["config","schema","pathing","action-handler"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}