gitbutlerapp/gitbutler · error
GitHub GraphQL repository not found for
Error message
GitHub GraphQL repository not found for {owner}/{repo} What it means
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.
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
Example fix
// before let repo = "acme/Repo-Old-Name"; client.set_pull_request_draft_state(¶ms_for(repo, pr)).await?; // after let repo = "acme/repo-new-name"; // updated after rename client.set_pull_request_draft_state(¶ms_for(repo, pr)).await?;
Defensive patterns
Strategy: validation
Validate before calling
// resolve owner/repo before the call and fail early on inaccessible repos
let repo_exists = std::process::Command::new("gh")
.args(["repo", "view", &format!("{owner}/{repo}"), "--json", "name"])
.status()?.success();
if !repo_exists { bail!("repository {owner}/{repo} not accessible with current token"); } Try / catch
match client.set_pull_request_draft_state(¶ms).await {
Err(e) if e.to_string().contains("repository not found") => {
eprintln!("check owner/repo slug and token access/SSO for {owner}/{repo}");
Err(e)
}
other => other,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Failed to add labels
- GitHub did not change the review thread resolution
- GitHub GraphQL convertPullRequestToDraft returned an empty…
- GitHub GraphQL disablePullRequestAutoMerge returned an…
- GitHub GraphQL enablePullRequestAutoMerge returned an empty…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/85ea474d82adae58.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-github/src/client.rs:1775
#[derive(Deserialize)]
struct GraphQlPullRequest {
id: String,
}
let data: QueryData = self
.graphql_query(
GQL_GET_PR_NODE_ID,
&Variables {
owner,
repo,
number: pr_number,
},
)
.await?;
let Some(repository) = data.repository else {
bail!("GitHub GraphQL repository not found for {owner}/{repo}");
};
let Some(pull_request) = repository.pull_request else {
bail!("GitHub GraphQL pull request #{pr_number} not found for {owner}/{repo}",);
};
if pull_request.id.is_empty() {
bail!(
"GitHub GraphQL pull request #{pr_number} in {owner}/{repo} returned an empty node id",
);
}
Ok(PullRequestNodeId::from_string(pull_request.id))
}
async fn graphql_query<T, V>(&self, query: &str, variables: &V) -> Result<T>
where
T: for<'de> Deserialize<'de>,View on GitHub (pinned to 58e5313667)