{"record":{"id":"337425e95d5b52e2","repo":"babalae/better-genshin-impact","slug":"action","errorCode":null,"errorMessage":"未知的后置 action 类型","messagePattern":"未知的后置 action 类型","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoPathing/Handler/ActionFactory.cs","lineNumber":36,"sourceCode":"                \"nahida_collect\" => new NahidaCollectHandler(),\n                \"pick_around\" => new PickAroundHandler(),\n                \"fight\" => new AutoFightHandler(),\n                \"normal_attack\" => new NormalAttackHandler(),\n                \"elemental_skill\" => new ElementalSkillHandler(),\n                \"hydro_collect\" => new ElementalCollectHandler(ElementalType.Hydro),\n                \"electro_collect\" => new ElementalCollectHandler(ElementalType.Electro),\n                \"anemo_collect\" => new ElementalCollectHandler(ElementalType.Anemo),\n                \"pyro_collect\" => new ElementalCollectHandler(ElementalType.Pyro),\n                \"combat_script\" => new CombatScriptHandler(),\n                \"mining\" => new MiningHandler(),\n                \"linnea_mining\" => new LinneaMiningHandler(),\n                \"fishing\" => new FishingHandler(),\n                \"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":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoPathing/Handler/ActionFactory.cs#L18-L54","documentation":"Thrown by ActionFactory.GetAfterHandler when the supplied action string doesn't match any known after-action (后置 action) handler. The switch covers nahida_collect, pick_around, fight, normal_attack, elemental_skill, hydro/electro/anemo/pyro_collect, combat_script, mining, linnea_mining, fishing, exit_and_relogin, wonderland_cycle, set_time, use_gadget, pick_up_collect; anything else hits the default.","triggerScenarios":"A pathing-task waypoint defines an `action` field with a value not in the known after-handler set, and GetAfterHandler is called with it.","commonSituations":"Typo in the JSON action field; a waypoint uses a newer action name unsupported by this build; schema drift between the task authoring tool and the runtime.","solutions":["Check the waypoint JSON and correct the action value to one of the supported after-action names.","Update BetterGI to a version that supports the action type if it is a legitimate new action.","Replace the unsupported action with the closest supported equivalent (e.g. pick_up_collect)."],"exampleFix":"// before\nvar handler = ActionFactory.GetAfterHandler(actionName); // throws on unknown\n\n// after — validate against the known set first\nvar knownAfter = new[]{\"nahida_collect\",\"pick_around\",\"fight\",\"normal_attack\",\"elemental_skill\",\"hydro_collect\",\"electro_collect\",\"anemo_collect\",\"pyro_collect\",\"combat_script\",\"mining\",\"linnea_mining\",\"fishing\",\"exit_and_relogin\",\"wonderland_cycle\",\"set_time\",\"use_gadget\",\"pick_up_collect\"};\nif (!knownAfter.Contains(actionName))\n{\n    throw new ArgumentException($\"未知的后置 action 类型: {actionName}. 支持的值: {string.Join(\", \", knownAfter)}\");\n}","handlingStrategy":"validation","validationCode":"var knownAfter = new[]{\"nahida_collect\",\"pick_around\",\"fight\",\"normal_attack\",\"elemental_skill\",\"hydro_collect\",\"electro_collect\",\"anemo_collect\",\"pyro_collect\",\"combat_script\",\"mining\",\"linnea_mining\",\"fishing\",\"exit_and_relogin\",\"wonderland_cycle\",\"set_time\",\"use_gadget\",\"pick_up_collect\"};\nif (!knownAfter.Contains(actionName))\n{\n    throw new ArgumentException($\"未知的后置 action 类型: {actionName}\");\n}","typeGuard":"static readonly HashSet<string> KnownAfterActions = new(){\"nahida_collect\",\"pick_around\",\"fight\",\"normal_attack\",\"elemental_skill\",\"hydro_collect\",\"electro_collect\",\"anemo_collect\",\"pyro_collect\",\"combat_script\",\"mining\",\"linnea_mining\",\"fishing\",\"exit_and_relogin\",\"wonderland_cycle\",\"set_time\",\"use_gadget\",\"pick_up_collect\"};\nbool IsValidAfterAction(string? a) => a is not null && KnownAfterActions.Contains(a);","tryCatchPattern":null,"preventionTips":["Validate waypoint action values against the known set when loading a pathing task.","Update the known-set list when upgrading to a build with new action types.","Author pathing tasks with a tool that only offers supported action names."],"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"}