babalae/better-genshin-impact · error · InvalidDataException
根实例连接响应缺少数据。
Error message
根实例连接响应缺少数据。
What it means
Thrown when the root instance returns Success == true for connection.open but response.Data cannot be converted to ConnectionOpenResponse (Data is null, or its JSON shape does not match). The protocol contract requires a populated ConnectionOpenResponse on a successful open.
Source
Thrown at BetterGenshinImpact/Service/Instance/InstanceBootstrap.cs:239
var response = InstanceIpcProtocol.ReadJson(frame.Value);
if (response.Operation != InstanceOperations.Response
|| response.RequestId != request.RequestId)
{
client.Dispose();
continue;
}
if (response.Success != true)
{
client.Dispose();
throw new InvalidOperationException(
response.ErrorMessage ?? response.ErrorCode ?? "根实例拒绝连接。");
}
var openResponse =
response.Data?.ToObject<ConnectionOpenResponse>(
InstanceIpcProtocol.Serializer)
?? throw new InvalidDataException("根实例连接响应缺少数据。");
return new InitialRootConnection(client, openResponse);
}
catch
{
client.Dispose();
throw;
}
}
catch (Exception exception) when (exception is IOException
or UnauthorizedAccessException
or TimeoutException
or OperationCanceledException)
{
Debug.WriteLine(exception);
Trace.TraceWarning(
"连接 BetterGI 根管道失败,命名管道:{0},原因:{1}",
pipeName,
exception.GetBaseException().Message);View on GitHub (pinned to a7cb36712d)
Solutions
- Ensure the connecting instance and the root instance are the exact same BetterGI build.
- Restart the root instance to clear any bad handler state.
- If reproducing on the same build, this is a handler bug — check the root's connection.open handler to confirm it always populates ConnectionOpenResponse.
Defensive patterns
Strategy: try-catch
Try / catch
try
{
var openResponse = response.Data?.ToObject<ConnectionOpenResponse>(InstanceIpcProtocol.Serializer)
?? throw new InvalidDataException("根实例连接响应缺少数据。");
}
catch (InvalidDataException ex)
{
logger.LogError(ex, "Root connection response missing data; version skew likely");
} Prevention
- Run the same BetterGI build for root and connecting instances.
- Restart the root instance to clear bad handler state.
- Unit-test the connection.open handler to confirm it always populates ConnectionOpenResponse on success.
When it happens
Trigger: Root handler returned a success response without setting Data, or the ConnectionOpenResponse serialization contract changed between builds so JObject.ToObject<ConnectionOpenResponse> returns null.
Common situations: Version skew between the root and the connecting instance — the root speaks a newer/older response shape; a handler bug that omits Data on the success path.
Related errors
- 根实例拒绝连接。
- 不支持的实例 IPC 版本:{envelope.Version}。
- 预期 JSON 帧,实际为 {frame.PayloadType}。
- 命名管道 JSON 消息为空。
- 预期相对鼠标帧,实际为 {frame.PayloadType}。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/d503b4db6972ef58.
Report an issue: GitHub.