{"record":{"id":"81e40a06ab3dfef2","repo":"babalae/better-genshin-impact","slug":"error-81e40a","errorCode":null,"errorMessage":"根实例连接响应缺少数据。","messagePattern":"根实例连接响应缺少数据。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Service/Instance/InstanceService.cs","lineNumber":432,"sourceCode":"                    connection.Start(cancellationToken);\n\n                    var openResult = await connection.SendRequestAsync(\n                        InstanceOperations.ConnectionOpen,\n                        new ConnectionOpenRequest\n                        {\n                            RequestedType = Context.InstanceType,\n                            RestartFromProcessId = restartFromProcessId,\n                            Arguments = includeActivationArguments\n                                ? Environment.GetCommandLineArgs()\n                                : []\n                        },\n                        RequestTimeout,\n                        cancellationToken).ConfigureAwait(false);\n                    EnsureSuccessfulResponse(openResult);\n                    openResponse =\n                        openResult.Data?.ToObject<ConnectionOpenResponse>(\n                            InstanceIpcProtocol.Serializer)\n                        ?? throw new InvalidDataException(\"根实例连接响应缺少数据。\");\n                }\n\n                if (openResponse.Disposition\n                    == ConnectionOpenDisposition.ActivationForwarded)\n                {\n                    RequestApplicationShutdown();\n                    return;\n                }\n                if (openResponse.AssignedType != Context.InstanceType)\n                {\n                    throw new InvalidOperationException(\n                        $\"根实例分配了不匹配的客户端类型：{openResponse.AssignedType}。\");\n                }\n\n                Context.SetRootSessionId(openResponse.RootSessionId);\n                connection.RemoteEndpoint = new InstanceEndpoint\n                {\n                    InstanceType = BetterGiInstanceType.Primary,","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/Instance/InstanceService.cs#L414-L450","documentation":"Thrown in RootConnectionLoopAsync when the connection.open response from the root instance deserializes to a null ConnectionOpenResponse. The code calls EnsureSuccessfulResponse(openResult) first (which passes), then attempts openResult.Data?.ToObject<ConnectionOpenResponse>(Serializer). If Data is null or cannot be deserialized to ConnectionOpenResponse, the cast yields null and this error fires.","triggerScenarios":"The root instance returned a successful connection.open response (Success == true) but the Data JObject is missing, is null, or has a schema that doesn't map to ConnectionOpenResponse (missing Disposition, AssignedType, RootProcessId, RootSessionId fields or wrong casing). Since the serializer uses CamelCasePropertyNamesContractResolver, a field-name mismatch between the request/response model and the JSON would cause silent null deserialization.","commonSituations":"Version mismatch between the child and root where ConnectionOpenResponse was modified (fields renamed, added, or removed); a root instance bug that returns a success response without populating Data; Newtonsoft.Json deserialization returning null due to a JSON type mismatch (e.g., RootProcessId sent as a string instead of int).","solutions":["Ensure the child and root processes run the same build version so ConnectionOpenResponse schema matches exactly.","Inspect the root-side CreateOpenResponse to confirm it always builds a ConnectionOpenResponse with all required fields.","Log openResult.Data?.ToString() before the ToObject call to see the actual JSON the root sent.","If developing a protocol change, update ConnectionOpenResponse in all peers and verify round-trip serialization with the CamelCase resolver."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In RootConnectionLoopAsync, this is already caught by:\ncatch (Exception exception) when (exception is InvalidOperationException or InvalidDataException)\n{\n    _logger.LogError(exception, \"不可恢复的协议错误，停止重连\");\n    RequestApplicationShutdown();\n    return;\n}","preventionTips":["Keep both peers on the same application version to avoid ConnectionOpenResponse schema skew.","Verify root-side CreateOpenResponse always populates all fields.","Log the raw response JSON when debugging deserialization failures."],"tags":["ipc","connection-handshake","deserialization","version-mismatch","root-connection"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}