{"record":{"id":"c692b67a42835d61","repo":"cli/cli","slug":"session-id-is-required-when-not-running-interactiv","errorCode":null,"errorMessage":"session ID is required when not running interactively","messagePattern":"session ID is required when not running interactively","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/agent-task/view/view.go","lineNumber":105,"sourceCode":"\t\t\t# View a pull request agents tasks in the browser\n\t\t\t$ gh agent-task view 12345 --web\n\t\t`),\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\t// Support -R/--repo override\n\t\t\topts.BaseRepo = f.BaseRepo\n\n\t\t\tif len(args) > 0 {\n\t\t\t\topts.SelectorArg = args[0]\n\t\t\t\tif shared.IsSessionID(opts.SelectorArg) {\n\t\t\t\t\topts.SessionID = opts.SelectorArg\n\t\t\t\t} else if sessionID, err := shared.ParseSessionIDFromURL(opts.SelectorArg); err == nil {\n\t\t\t\t\topts.SessionID = sessionID\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif opts.SessionID == \"\" && !opts.IO.CanPrompt() {\n\t\t\t\treturn fmt.Errorf(\"session ID is required when not running interactively\")\n\t\t\t}\n\n\t\t\tif opts.Follow && !opts.Log {\n\t\t\t\treturn cmdutil.FlagErrorf(\"--log is required when providing --follow\")\n\t\t\t}\n\n\t\t\tif opts.Finder == nil {\n\t\t\t\topts.Finder = prShared.NewFinder(f)\n\t\t\t}\n\n\t\t\tif runF != nil {\n\t\t\t\treturn runF(opts)\n\t\t\t}\n\t\t\treturn viewRun(opts)\n\t\t},\n\t}\n\n\tcmdutil.EnableRepoOverride(cmd, f)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/agent-task/view/view.go#L87-L123","documentation":"Error \"session ID is required when not running interactively\" thrown in cli/cli.","triggerScenarios":"Thrown at pkg/cmd/agent-task/view/view.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the session ID explicitly (e.g. `gh agent-task view <session-id>`), or run the command in an interactive terminal to pick a session."],"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-15T17:31:12.345Z"}