gitbutlerapp/gitbutler · error
GitHub GraphQL disablePullRequestAutoMerge returned an…
Error message
GitHub GraphQL disablePullRequestAutoMerge returned an empty pull request id
What it means
Mirror of the enable case: the GraphQL disablePullRequestAutoMerge mutation returned a payload whose pull request id is empty, so the client cannot confirm that auto-merge was actually disabled for the PR and reports the ambiguous result as an error.
Solutions
- Check pull_request.auto_merge_request exists before calling the disable mutation
- Handle races gracefully: refetch the PR state and treat 'already merged' as success
- Inspect the raw GraphQL response for a top-level errors array explaining the empty payload
Example fix
// before
client.disable_pull_request_auto_merge(¶ms).await?;
// after
if pr.auto_merge_request.is_none() {
return Ok(()); // nothing to disable
}
client.disable_pull_request_auto_merge(¶ms).await?; Defensive patterns
Strategy: validation
Validate before calling
// only disable when auto-merge is active
if pr.auto_merge_request.is_none() { return Ok(()); } Try / catch
match client.disable_pull_request_auto_merge(¶ms).await {
Err(e) if e.to_string().contains("empty pull request id") => {
// auto-merge may already be gone or the PR merged; refetch before failing
let pr = client.get_pull_request(owner, repo, pr_number).await?;
if pr.auto_merge_request.is_none() || pr.merged { Ok(()) } else { Err(e) }
}
other => other,
} Prevention
- Check auto_merge_request before disabling
- Handle the merged-PR race as success
- Avoid concurrent automations toggling auto-merge on the same PR
- Refetch PR state after ambiguous mutation failures
When it happens
Trigger: Calling disable auto-merge when no auto-merge request exists on the PR (mutation is effectively a no-op) or the response payload is missing the node id due to API/schema behavior.
Common situations: Race conditions where GitHub already merged the PR before disabling auto-merge; callers disabling auto-merge on PRs that never had it enabled; concurrent automations toggling the same PR.
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 enablePullRequestAutoMerge returned an empty…
- GitHub GraphQL convertPullRequestToDraft returned an empty…
- GitHub GraphQL markPullRequestReadyForReview returned an…
- GitHub GraphQL pull request
- Could not update all PR targets before native stack…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/2fff9ad53b0f8bb2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-github/src/client.rs:1728
}
#[derive(Deserialize)]
struct MutationData {
#[serde(rename = "disablePullRequestAutoMerge")]
disable_pull_request_auto_merge: MutationPayload,
}
let data: MutationData = self
.graphql_query(GQL_DISABLE_PR_AUTO_MERGE, &Variables { pull_request_id })
.await?;
if data
.disable_pull_request_auto_merge
.pull_request
.id
.is_empty()
{
bail!("GitHub GraphQL disablePullRequestAutoMerge returned an empty pull request id");
}
Ok(())
}
async fn get_pull_request_node_id(
&self,
owner: &str,
repo: &str,
pr_number: i64,
) -> Result<PullRequestNodeId> {
#[derive(Serialize)]
struct Variables<'a> {
owner: &'a str,
repo: &'a str,
number: i64,
}
View on GitHub (pinned to 58e5313667)