cli/cli · error

failed to list sessions for pull request: %w

Error message

failed to list sessions for pull request: %w

What it means

Error "failed to list sessions for pull request: %w" thrown in cli/cli.

Source

Thrown at pkg/cmd/agent-task/view/view.go:232

				return err
			}

			if repo.RepoHost() != ghinstance.Default() {
				return fmt.Errorf("agent tasks are not supported on this host: %s", repo.RepoHost())
			}

			databaseID, err := strconv.ParseInt(pr.FullDatabaseID, 10, 64)
			if err != nil {
				return fmt.Errorf("failed to parse pull request: %w", err)
			}

			prID = databaseID
			prURL = pr.URL
		}

		sessions, err := capiClient.ListSessionsByResourceID(ctx, "pull", prID, defaultLimit)
		if err != nil {
			return fmt.Errorf("failed to list sessions for pull request: %w", err)
		}

		if len(sessions) == 0 {
			fmt.Fprintln(opts.IO.ErrOut, "no session found for pull request")
			return cmdutil.SilentError
		}

		opts.IO.StopProgressIndicator()

		if opts.Web {
			// Note that, we needed to make sure the PR exists and it has at least one session
			// associated with it, other wise the `/agent-sessions` page would display the 404
			// error.

			// We don't need to navigate to a specific session; if there's only one session
			// then the GUI will automatically show it, otherwise the user can select from the
			// list. This is to avoid unnecessary prompting.
			webURL := prURL + "/agent-sessions"

View on GitHub (pinned to 0eeec0b92e)

Solutions

  1. Check authentication and network access with `gh auth status`, then retry.

When it happens

Trigger: Thrown at pkg/cmd/agent-task/view/view.go:232 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15). Data as JSON: /api/errors/4e49cb7b22708ce4. Report an issue: GitHub.