{"record":{"id":"1aab4527df07a3fa","repo":"gitbutlerapp/gitbutler","slug":"github-graphql-pull-request-pr-number-in-owner","errorCode":null,"errorMessage":"GitHub GraphQL pull request #{pr_number} in {owner}/{repo} returned an empty node id","messagePattern":"GitHub GraphQL pull request #(.+?) in (.+?)/(.+?) returned an empty node id","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-github/src/client.rs","lineNumber":1783,"sourceCode":"                GQL_GET_PR_NODE_ID,\n                &Variables {\n                    owner,\n                    repo,\n                    number: pr_number,\n                },\n            )\n            .await?;\n\n        let Some(repository) = data.repository else {\n            bail!(\"GitHub GraphQL repository not found for {owner}/{repo}\");\n        };\n\n        let Some(pull_request) = repository.pull_request else {\n            bail!(\"GitHub GraphQL pull request #{pr_number} not found for {owner}/{repo}\",);\n        };\n\n        if pull_request.id.is_empty() {\n            bail!(\n                \"GitHub GraphQL pull request #{pr_number} in {owner}/{repo} returned an empty node id\",\n            );\n        }\n\n        Ok(PullRequestNodeId::from_string(pull_request.id))\n    }\n\n    async fn graphql_query<T, V>(&self, query: &str, variables: &V) -> Result<T>\n    where\n        T: for<'de> Deserialize<'de>,\n        V: Serialize,\n    {\n        #[derive(Serialize)]\n        struct GraphQlRequest<'a, V> {\n            query: &'a str,\n            variables: &'a V,\n        }\n","sourceCodeStart":1765,"sourceCodeEnd":1801,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-github/src/client.rs#L1765-L1801","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading the GitHub CLI/library against a changed GraphQL schema; a proxy or gateway stripping response fields; caching layers returning partial payloads.","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"],"exampleFix":"// before\nlet node_id = client.get_pull_request_node_id(owner, repo, pr).await?; // empty id\n// after\nlet node_id: String = match gh_fallback_fetch_node_id(owner, repo, pr) {\n    Ok(id) if !id.is_empty() => id,\n    _ => bail!(\"unable to resolve PR node id\"),\n};","handlingStrategy":"retry","validationCode":"// resolve the node id and refuse to proceed on empty values\nlet node_id = client.get_pull_request_node_id(owner, repo, pr_number).await?;\nif node_id.as_str().is_empty() { bail!(\"node id empty; aborting mutation\"); }","typeGuard":null,"tryCatchPattern":"// one retry, then fall back to fetching the id another way\nmatch client.get_pull_request_node_id(owner, repo, pr_number).await {\n    Err(e) if e.to_string().contains(\"empty node id\") => {\n        tokio::time::sleep(Duration::from_secs(1)).await;\n        client.get_pull_request_node_id(owner, repo, pr_number).await\n    }\n    other => other,\n}","preventionTips":["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"],"tags":["github","graphql","response-validation","node-id"],"backgroundTag":"empty-required-field","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}