{"record":{"id":"f3ac035d5cd0b070","repo":"cli/cli","slug":"no-commit-found-on-the-pull-request","errorCode":null,"errorMessage":"no commit found on the pull request","messagePattern":"no commit found on the pull request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pr/checks/checks.go","lineNumber":287,"sourceCode":"\t\t\t}\n\t\t}\n\t}`, api.RequiredStatusCheckRollupGraphQL(\"$id\", \"$endCursor\", includeEvent))\n\n\tvariables := map[string]interface{}{\n\t\t\"id\": pr.ID,\n\t}\n\n\tstatusCheckRollup := api.CheckContexts{}\n\n\tfor {\n\t\tvar resp response\n\t\terr := apiClient.GraphQL(repo.RepoHost(), query, variables, &resp)\n\t\tif err != nil {\n\t\t\treturn nil, checkCounts{}, err\n\t\t}\n\n\t\tif len(resp.Node.StatusCheckRollup.Nodes) == 0 {\n\t\t\treturn nil, checkCounts{}, errors.New(\"no commit found on the pull request\")\n\t\t}\n\n\t\tresult := resp.Node.StatusCheckRollup.Nodes[0].Commit.StatusCheckRollup.Contexts\n\t\tstatusCheckRollup.Nodes = append(\n\t\t\tstatusCheckRollup.Nodes,\n\t\t\tresult.Nodes...,\n\t\t)\n\n\t\tif !result.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t}\n\t\tvariables[\"endCursor\"] = result.PageInfo.EndCursor\n\t}\n\n\tif len(statusCheckRollup.Nodes) == 0 {\n\t\treturn nil, checkCounts{}, fmt.Errorf(\"no checks reported on the '%s' branch\", pr.HeadRefName)\n\t}\n","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/pr/checks/checks.go#L269-L305","documentation":"Thrown by the checks-rolling query in gh pr checks when the PR's StatusCheckRollup node list is empty - meaning the head commit has no check contexts to report. Most commonly this happens for PRs whose head commit has not been pushed or has no CI configured, or empty PRs.","triggerScenarios":"`gh pr checks <n>` where the pull request has zero commits (opened from a branch with no diff/no pushed head), or where the rollup query returns an empty node list for the head SHA; commonly right after opening a PR before CI triggers with no required checks configured.","commonSituations":"Polling `gh pr checks --watch` in CI immediately after PR creation; repos with no workflows/checks at all; PRs from deleted head branches.","solutions":["Confirm the PR has a head commit and diff: `gh pr view <n> --json commits,state`","If the repo has no checks configured, skip polling; gate on workflow existence (`gh workflow list`)","Wait for CI to start before polling, or use `gh pr checks <n> --watch` which tolerates the startup window once contexts exist"],"exampleFix":"# before\ngh pr checks 7   # PR just opened, CI not started, no checks ever configured\n# after\ngh pr checks 7 --json 2>/dev/null || echo \"no checks; repo has no CI configured\"","handlingStrategy":"validation","validationCode":"commits=$(gh pr view $N --json commits --jq 'length')\n[ \"$commits\" -gt 0 ] || { echo \"PR has no commits; nothing to check\" >&2; exit 0; }\ngh pr checks $N","typeGuard":null,"tryCatchPattern":"Treat 'no commit found on the pull request' as a soft-empty in scripts: if grep -q matches, exit 0 (no CI) rather than failing the pipeline.","preventionTips":["Confirm the PR has a head commit before polling checks","Gate check-polling on at least one configured workflow (gh workflow list)","Add a startup delay or event trigger (push webhook) instead of polling instantly after pr create"],"tags":["pull-request","checks","ci","cli"],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}