gitbutlerapp/gitbutler · error
GitHub GraphQL pull request #
Error message
GitHub GraphQL pull request #{pr_number} in {owner}/{repo} returned an empty node id What it means
The repository and pull_request both resolved in GraphQL, but the returned pull_request.id (the GraphQL node id used for mutations like markPullRequestReadyForReview) was an empty string. The library cannot perform subsequent node-based mutations without it, so it bails.
Solutions
- Run the same query via gh api graphql and confirm whether id is present in the raw response
- Update the crate to a version whose GraphQL query matches the current GitHub schema
- Retry once — transient truncation/proxy issues may resolve
- If behind a proxy/gateway, check that it does not rewrite or trim GraphQL responses
Example fix
// before
let node_id = client.get_pull_request_node_id(owner, repo, pr).await?; // empty id
// after
let node_id: String = match gh_fallback_fetch_node_id(owner, repo, pr) {
Ok(id) if !id.is_empty() => id,
_ => bail!("unable to resolve PR node id"),
}; Defensive patterns
Strategy: retry
Validate before calling
// resolve the node id and refuse to proceed on empty values
let node_id = client.get_pull_request_node_id(owner, repo, pr_number).await?;
if node_id.as_str().is_empty() { bail!("node id empty; aborting mutation"); } Try / catch
// one retry, then fall back to fetching the id another way
match client.get_pull_request_node_id(owner, repo, pr_number).await {
Err(e) if e.to_string().contains("empty node id") => {
tokio::time::sleep(Duration::from_secs(1)).await;
client.get_pull_request_node_id(owner, repo, pr_number).await
}
other => other,
} Prevention
- Keep the crate current with GitHub GraphQL schema changes
- Retry idempotent lookups once on empty payloads
- Check proxy/gateway layers for GraphQL response rewriting
- Cross-check with gh api graphql when the id mysteriously comes back empty
When it happens
Trigger: The GraphQL query succeeded but the id field came back empty/absent — usually schema drift (field removed/renamed in the queried fragment), a malformed selection set, or GitHub returning a truncated payload.
Common situations: Upgrading the GitHub CLI/library against a changed GraphQL schema; a proxy or gateway stripping response fields; caching layers returning partial payloads.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- GitHub GraphQL markPullRequestReadyForReview returned an…
- GitHub did not change the review thread resolution
- GitHub GraphQL convertPullRequestToDraft returned an empty…
- GitHub GraphQL disablePullRequestAutoMerge returned an…
- GitHub GraphQL enablePullRequestAutoMerge returned an empty…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/1aab4527df07a3fa.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-github/src/client.rs:1783
GQL_GET_PR_NODE_ID,
&Variables {
owner,
repo,
number: pr_number,
},
)
.await?;
let Some(repository) = data.repository else {
bail!("GitHub GraphQL repository not found for {owner}/{repo}");
};
let Some(pull_request) = repository.pull_request else {
bail!("GitHub GraphQL pull request #{pr_number} not found for {owner}/{repo}",);
};
if pull_request.id.is_empty() {
bail!(
"GitHub GraphQL pull request #{pr_number} in {owner}/{repo} returned an empty node id",
);
}
Ok(PullRequestNodeId::from_string(pull_request.id))
}
async fn graphql_query<T, V>(&self, query: &str, variables: &V) -> Result<T>
where
T: for<'de> Deserialize<'de>,
V: Serialize,
{
#[derive(Serialize)]
struct GraphQlRequest<'a, V> {
query: &'a str,
variables: &'a V,
}
View on GitHub (pinned to 58e5313667)