gitbutlerapp/gitbutler · error · anyhow::Error

GitHub GraphQL response did not include data

Error message

GitHub GraphQL response did not include data

What it means

A 200 GraphQL response contained neither `errors` nor `data`. GitHub never sends this shape, so the decoder refuses to guess; the body most likely never came from GitHub's GraphQL endpoint unmodified.

Source

Thrown at crates/but-github/src/client.rs:1304

    #[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>
    where

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Check the configured base URL - it must reach the real GitHub API host
  2. Bypass or whitelist the proxy for the GitHub API host
  3. Capture the raw response body once to identify what is actually answering
Defensive patterns

Strategy: try-catch

Try / catch

match client.graphql_query(query, &vars).await {
    Err(e) if e.to_string().contains("did not include data") => {
        // capture the raw body once via a debug proxy to find the interceptor
        log::warn!("non-GitHub-shaped GraphQL response: {e}");
        return Err(e);
    }
    other => other?,
}

Prevention

When it happens

Trigger: A proxy or gateway rewrote or emptied the response body; base_url misconfiguration landing on an endpoint that returns 200 with an HTML page; GitHub Enterprise anomalies.

Common situations: Corporate proxies with content inspection; custom forge base URLs; API gateways in front of GitHub.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/42578707642b2228. Report an issue: GitHub.