{"record":{"id":"85ea474d82adae58","repo":"gitbutlerapp/gitbutler","slug":"github-graphql-repository-not-found-for-owner-r","errorCode":null,"errorMessage":"GitHub GraphQL repository not found for {owner}/{repo}","messagePattern":"GitHub GraphQL repository not found for (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-github/src/client.rs","lineNumber":1775,"sourceCode":"\n        #[derive(Deserialize)]\n        struct GraphQlPullRequest {\n            id: String,\n        }\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>,","sourceCodeStart":1757,"sourceCodeEnd":1793,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-github/src/client.rs#L1757-L1793","documentation":"In get_pull_request_node_id, the repository( owner, name) GraphQL lookup for resolving a PR number to its node id returned null for the repository field. GitHub omits the repository when the name is wrong, the repo is private/inaccessible to the token, or the resource was deleted.","triggerScenarios":"Calling any draft/auto-merge API that internally resolves the node id with an owner/repo pair GitHub cannot resolve: misspelled owner or repo, token lacking access to a private repo, SSO not authorized for the org, or the repo renamed/deleted.","commonSituations":"Repos renamed (e.g. org renamed, old config still points at the old slug); fine-grained PAT not granted the specific repository; org SAML SSO authorization missing; using a token from a different account.","solutions":["Verify owner/repo spelling and that the repository still exists at github.com/{owner}/{repo}","Check token access: for fine-grained PATs, grant the repository; run gh auth status and re-authorize SSO for the org","Update configuration after repo/org renames","Confirm the token belongs to an account with read access to the repository"],"exampleFix":"// before\nlet repo = \"acme/Repo-Old-Name\";\nclient.set_pull_request_draft_state(&params_for(repo, pr)).await?;\n// after\nlet repo = \"acme/repo-new-name\"; // updated after rename\nclient.set_pull_request_draft_state(&params_for(repo, pr)).await?;","handlingStrategy":"validation","validationCode":"// resolve owner/repo before the call and fail early on inaccessible repos\nlet repo_exists = std::process::Command::new(\"gh\")\n    .args([\"repo\", \"view\", &format!(\"{owner}/{repo}\"), \"--json\", \"name\"])\n    .status()?.success();\nif !repo_exists { bail!(\"repository {owner}/{repo} not accessible with current token\"); }","typeGuard":null,"tryCatchPattern":"match client.set_pull_request_draft_state(&params).await {\n    Err(e) if e.to_string().contains(\"repository not found\") => {\n        eprintln!(\"check owner/repo slug and token access/SSO for {owner}/{repo}\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Update config immediately after repo or org renames","Run gh auth status and authorize SSO for the org","Grant fine-grained PATs the specific repositories they touch","Pin full owner/repo strings in configuration, never bare repo names"],"tags":["github","graphql","repository-not-found","permissions"],"backgroundTag":"resource-not-found","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"}