{"record":{"id":"fb82da1208bf94d4","repo":"babalae/better-genshin-impact","slug":"error-fb82da","errorCode":null,"errorMessage":"激活请求缺少命令行参数。","messagePattern":"激活请求缺少命令行参数。","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/Service/Instance/MessageHandlers/InstanceRequestHandler.cs","lineNumber":123,"sourceCode":"    /// </summary>\n    private InstanceIpcEnvelope HandleActivationDispatch(\n        InstanceConnection connection,\n        InstanceIpcEnvelope request)\n    {\n        if (_context.InstanceType == BetterGiInstanceType.Primary\n            || connection.RemoteEndpoint?.InstanceType != BetterGiInstanceType.Primary)\n        {\n            throw new InvalidOperationException(\"只有根实例可以向 BetterGI 客户端分发激活消息。\");\n        }\n\n        if (_activationResponses.TryGetValue(request.RequestId, out var cachedResponse))\n        {\n            return cachedResponse;\n        }\n\n        var activation =\n            request.Data?.ToObject<ActivationDispatchRequest>(InstanceIpcProtocol.Serializer)\n            ?? throw new ArgumentException(\"激活请求缺少命令行参数。\");\n        _enqueueActivation(activation.Arguments);\n        return CacheActivationResponse(\n            request.RequestId,\n            InstanceIpcEnvelope.Response(request));\n    }\n\n    /// <summary>\n    /// 校验子实例身份和启动记录后，将当前连接登记为有效子连接。\n    /// v2 不再校验父实例 ID 或启动记录，而是使用根管道客户端的真实 PID 和 Session。\n    /// </summary>\n    private async Task<InstanceIpcEnvelope> HandleConnectionOpenAsync(\n        InstanceConnection connection,\n        InstanceIpcEnvelope request,\n        CancellationToken cancellationToken)\n    {\n        if (_context.InstanceType != BetterGiInstanceType.Primary)\n        {\n            throw new InvalidOperationException(\"只有根实例可以接受客户端连接登记。\");","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/Instance/MessageHandlers/InstanceRequestHandler.cs#L105-L141","documentation":"Thrown by HandleActivationDispatch when request.Data is null or cannot be deserialized to ActivationDispatchRequest. The activation dispatch carries command-line arguments to be replayed in the target instance; a null Data or deserialization failure means the request is structurally incomplete. This is an ArgumentException (caller-side contract), not InvalidDataException (wire-level).","triggerScenarios":"The root sends an activation.dispatch request whose Data JObject is null (was not set) or whose JSON does not map to ActivationDispatchRequest (missing Arguments field, wrong type). Since InstanceIpcEnvelope.Request serializes data via JObject.FromObject, a null data parameter at construction would produce a null Data field.","commonSituations":"The root's HandleConnectionOpenAsync builds ActivationDispatchRequest but passes null or empty Arguments; a version mismatch where ActivationDispatchRequest.Arguments was renamed or removed; a bug in the forwarding code that constructs the dispatch without data; test code that hand-builds an envelope without Data.","solutions":["Verify the root-side dispatch construction in HandleConnectionOpenAsync: new ActivationDispatchRequest { Arguments = open.Arguments } — ensure open.Arguments is not null.","Ensure ConnectionOpenRequest.Arguments defaults to [] (empty array) as defined, so it is never null.","Check for version match between peers so ActivationDispatchRequest schema is consistent.","If handling programmatically, validate request.Data is not null before calling HandleActivationDispatch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before sending activation.dispatch, ensure Arguments is non-null\nvar dispatchData = new ActivationDispatchRequest\n{\n    Arguments = open.Arguments ?? []\n};\nvar request = InstanceIpcEnvelope.Request(InstanceOperations.ActivationDispatch, dispatchData);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure ConnectionOpenRequest.Arguments defaults to [] and is never null.","Always populate ActivationDispatchRequest.Arguments when constructing dispatch requests.","Verify protocol version match so the schema is consistent."],"tags":["ipc","activation","deserialization","argument-error","request-validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}