gitbutlerapp/gitbutler · error
GitHub GraphQL response did not include data
Error message
GitHub GraphQL response did not include data
What it means
The GitHub GraphQL response contained neither an `errors` array nor a `data` field, so the client has nothing to deserialize. This indicates a structurally unexpected response from GitHub — the payload shape violated the GraphQL contract this client expects.
Solutions
- Log the raw response body before parsing to see what GitHub actually returned.
- Check the GitHub status page for incidents affecting the GraphQL API.
- Retry the request once — transient gateway issues often produce empty payloads.
- Verify the client's GraphQL response struct still matches the current GitHub GraphQL schema.
- Ensure no middleware/proxy is stripping or rewriting the response body.
Defensive patterns
Strategy: retry
Try / catch
match client.call().await {
Ok(v) => v,
Err(e) if e.to_string().contains("did not include data") => {
tokio::time::sleep(Duration::from_secs(2)).await;
retry_with_backoff(3).await // transient gateway/empty-body issue
}
Err(e) => return Err(e),
} Prevention
- Log raw response bodies on parse failures to diagnose empty payloads.
- Retry idempotent GraphQL queries once on empty-data responses.
- Monitor GitHub status and prefer circuit-breaking during incidents.
- Avoid proxies that may strip response bodies.
When it happens
Trigger: A GraphQL call in but-github's client where the parsed payload has `errors: null` and `data: null` — e.g. a proxy or gateway returning an empty/invalid JSON body, or a schema/type mismatch deserializing the response envelope.
Common situations: Corporate proxies or GitHub incident/degraded states returning empty 200 responses; an API preview or schema change removing the expected field; a bug where the response was consumed before parsing.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- GitHub GraphQL returned errors
- Could not restore native GitHub stack membership after the…
- Could not update all PR targets before native stack…
- Failed to add labels
- Failed to add to GitHub stack
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/42578707642b2228.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-github/src/client.rs:1856
#[derive(Deserialize)]
struct GraphQlResponse {
data: Option<serde_json::Value>,
errors: Option<Vec<GraphQlError>>,
}
let payload: GraphQlResponse = serde_json::from_slice(body)?;
if let Some(errors) = payload.errors {
let messages = errors
.into_iter()
.map(|error| error.message)
.collect::<Vec<_>>()
.join("; ");
bail!("GitHub GraphQL returned errors: {messages}");
}
let Some(data) = payload.data else {
bail!("GitHub GraphQL response did not include data");
};
Ok(serde_json::from_value(data)?)
}
pub struct PullRequestNodeId {
id: String,
}
impl PullRequestNodeId {
pub fn from_string(value: String) -> Self {
PullRequestNodeId { id: value }
}
}
impl Serialize for PullRequestNodeId {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
whereView on GitHub (pinned to 58e5313667)