{"record":{"id":"90b878f7062708ea","repo":"gitbutlerapp/gitbutler","slug":"github-graphql-pull-request-pr-number-not-found","errorCode":null,"errorMessage":"GitHub GraphQL pull request #{pr_number} not found for {owner}/{repo}","messagePattern":"GitHub GraphQL pull request #(.+?) not found for (.+?)/(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-github/src/client.rs","lineNumber":1231,"sourceCode":"        }\n\n        let data: QueryData = self\n            .graphql_query(\n                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> {","sourceCodeStart":1213,"sourceCodeEnd":1249,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-github/src/client.rs#L1213-L1249","documentation":"The repository resolved, but pullRequest(number: N) inside it returned null: that repo has no pull request with the given number as far as the authenticated account can see.","triggerScenarios":"Passing a PR number from a different repository (stale remote or copied URL); a number that simply does not exist; repo ownership transferred so the numbering context changed; PRs on private forks the token cannot read.","commonSituations":"Hard-coded or cached PR numbers reused across repos; confusion between issue numbers and PR numbers; automation configs copied between projects.","solutions":["Verify by opening https://github.com/{owner}/{repo}/pull/{number} in a browser","If the repo was renamed or transferred, update the owner/repo configuration","List the repo's open pull requests to find the correct number"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let prs = client.list_pull_requests(owner, repo, &Default::default()).await?;\nlet exists = prs.iter().any(|pr| pr.number == number);\nif !exists { anyhow::bail!(\"PR #{number} does not exist in {owner}/{repo}\"); }","typeGuard":null,"tryCatchPattern":"match client.get_pull_request_node_id(owner, repo, n).await {\n    Err(e) if e.to_string().contains(\"pull request #\") && e.to_string().contains(\"not found\") => {\n        refresh_pr_number_from_api()\n    }\n    other => other?,\n}","preventionTips":["Get PR numbers from API responses, never from cached config","Re-verify numbers after repo renames or transfers","Remember GitHub shares one number space for issues and PRs"],"tags":["github","graphql","pull-request","not-found"],"backgroundTag":"github-pull-request-not-found","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}