{"record":{"id":"4e49cb7b22708ce4","repo":"cli/cli","slug":"failed-to-list-sessions-for-pull-request-w","errorCode":null,"errorMessage":"failed to list sessions for pull request: %w","messagePattern":"failed to list sessions for pull request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/agent-task/view/view.go","lineNumber":232,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif repo.RepoHost() != ghinstance.Default() {\n\t\t\t\treturn fmt.Errorf(\"agent tasks are not supported on this host: %s\", repo.RepoHost())\n\t\t\t}\n\n\t\t\tdatabaseID, err := strconv.ParseInt(pr.FullDatabaseID, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to parse pull request: %w\", err)\n\t\t\t}\n\n\t\t\tprID = databaseID\n\t\t\tprURL = pr.URL\n\t\t}\n\n\t\tsessions, err := capiClient.ListSessionsByResourceID(ctx, \"pull\", prID, defaultLimit)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to list sessions for pull request: %w\", err)\n\t\t}\n\n\t\tif len(sessions) == 0 {\n\t\t\tfmt.Fprintln(opts.IO.ErrOut, \"no session found for pull request\")\n\t\t\treturn cmdutil.SilentError\n\t\t}\n\n\t\topts.IO.StopProgressIndicator()\n\n\t\tif opts.Web {\n\t\t\t// Note that, we needed to make sure the PR exists and it has at least one session\n\t\t\t// associated with it, other wise the `/agent-sessions` page would display the 404\n\t\t\t// error.\n\n\t\t\t// We don't need to navigate to a specific session; if there's only one session\n\t\t\t// then the GUI will automatically show it, otherwise the user can select from the\n\t\t\t// list. This is to avoid unnecessary prompting.\n\t\t\twebURL := prURL + \"/agent-sessions\"","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/agent-task/view/view.go#L214-L250","documentation":"Error \"failed to list sessions for pull request: %w\" thrown in cli/cli.","triggerScenarios":"Thrown at pkg/cmd/agent-task/view/view.go:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check authentication and network access with `gh auth status`, then retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}