gitbutlerapp/gitbutler · error
GitHub GraphQL enablePullRequestAutoMerge returned an empty…
Error message
GitHub GraphQL enablePullRequestAutoMerge returned an empty pull request id
What it means
The GraphQL enablePullRequestAutoMerge mutation completed, but the returned payload's pull request id was empty. GitHub acknowledged the mutation without yielding a usable PR node, which the client treats as a failed or ambiguous enable-auto-merge rather than assuming success.
Solutions
- Ensure the repository has branch protection with required status checks — auto-merge requires them
- Check whether auto-merge is already enabled on the PR and skip the call
- Verify repository plan/settings allow auto-merge (repo setting 'Allow auto-merge' must be on)
- Query the raw mutation via gh api graphql to see whether an errors array accompanies the empty id
Example fix
// before
client.enable_pull_request_auto_merge(¶ms).await?;
// after
if pr.auto_merge_request.is_some() {
return Ok(()); // auto-merge already enabled
}
client.enable_pull_request_auto_merge(¶ms).await?; Defensive patterns
Strategy: validation
Validate before calling
// auto-merge requires branch protection with required checks; and must not already be set
if pr.auto_merge_request.is_some() { return Ok(()); }
if !repo_has_required_checks(owner, repo) { return Err(anyhow!("auto-merge needs required status checks")); } Try / catch
match client.enable_pull_request_auto_merge(¶ms).await {
Err(e) if e.to_string().contains("empty pull request id") => {
// check whether auto-merge actually got enabled despite the empty id
let pr = client.get_pull_request(owner, repo, pr_number).await?;
if pr.auto_merge_request.is_some() { Ok(()) } else { Err(e) }
}
other => other,
} Prevention
- Enable 'Allow auto-merge' and required status checks in repo settings first
- Skip the call when auto-merge is already enabled
- Confirm repo plan supports auto-merge
- Inspect the GraphQL errors array when the node id comes back empty
When it happens
Trigger: Calling enable auto-merge when the response contains no node id: the PR may not satisfy auto-merge preconditions (branch protection without required checks configured), auto-merge may already be enabled, or the repo/plan doesn't support it.
Common situations: Enabling auto-merge on repos without branch protection rules (GitHub rejects or returns unusable payloads); PR already queued for auto-merge; free-plan repos where auto-merge is unavailable.
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 disablePullRequestAutoMerge returned an…
- 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/d20ece4bc0c13766.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-github/src/client.rs:1685
input: EnablePullRequestAutoMergeInput {
pull_request_id,
merge_method: params.merge_method.as_ref().map(Into::into),
expected_head_oid: params.expected_head_oid,
commit_headline: params.commit_headline,
commit_body: params.commit_body,
author_email: params.author_email,
},
},
)
.await?;
if data
.enable_pull_request_auto_merge
.pull_request
.id
.is_empty()
{
bail!("GitHub GraphQL enablePullRequestAutoMerge returned an empty pull request id");
}
Ok(())
}
async fn disable_auto_merge_pull_request(
&self,
pull_request_id: &PullRequestNodeId,
) -> Result<()> {
#[derive(Deserialize)]
struct MutationPayload {
#[serde(rename = "pullRequest")]
pull_request: GraphQlPullRequest,
}
#[derive(Deserialize)]
struct GraphQlPullRequest {
id: String,View on GitHub (pinned to 58e5313667)