{"record":{"id":"1c4defd36b63a901","repo":"cli/cli","slug":"agent-tasks-are-not-supported-on-this-host","errorCode":null,"errorMessage":"agent tasks are not supported on this host","messagePattern":"agent tasks are not supported on this host","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/cmd/agent-task/agent_task.go","lineNumber":84,"sourceCode":"\treturn cmd\n}\n\n// requireOAuthToken ensures an OAuth (device flow) token is present and valid.\n// agent-task subcommands inherit this check via PersistentPreRunE.\nfunc requireOAuthToken(f *cmdutil.Factory) error {\n\tcfg, err := f.Config()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthCfg := cfg.Authentication()\n\thost, _ := authCfg.DefaultHost()\n\tif host == \"\" {\n\t\treturn errors.New(\"no default host configured; run 'gh auth login'\")\n\t}\n\n\tif auth.IsEnterprise(host) {\n\t\treturn errors.New(\"agent tasks are not supported on this host\")\n\t}\n\n\ttoken, source := authCfg.ActiveToken(host)\n\n\t// Tokens from sources \"oauth_token\" and \"keyring\" are likely\n\t// minted through our device flow.\n\ttokenSourceIsDeviceFlow := source == \"oauth_token\" || source == \"keyring\"\n\t// Tokens with \"gho_\" prefix are OAuth tokens.\n\ttokenIsOAuth := strings.HasPrefix(token, \"gho_\")\n\n\t// Reject if the token is not from a device flow source or is not an OAuth token\n\tif !tokenSourceIsDeviceFlow || !tokenIsOAuth {\n\t\treturn fmt.Errorf(\"this command requires an OAuth token. Re-authenticate with: gh auth login\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":66,"sourceCodeEnd":101,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/agent-task/agent_task.go#L66-L101","documentation":"ParseFullReference rejects strings that do not match ^(?:([^/]+)/([^/]+))#(\\d+)$, i.e. anything that is not exactly OWNER/REPO#NUMBER. Empty input is handled separately ('empty reference'); this branch is for non-empty strings with the wrong shape.","triggerScenarios":"Passing '123' (bare number), 'owner#123' (missing repo), 'owner/repo#abc' (non-numeric), 'https://.../pull/123' (URL where a reference was expected), or trailing characters like 'owner/repo#123!'.","commonSituations":"Users pasting URLs or bare numbers where the CLI documents the OWNER/REPO#N form; scripts concatenating slug and number with the wrong separator.","solutions":["Use the exact form OWNER/REPO#NUMBER, e.g. acme/widgets#123.","If you only have a number, also pass --repo OWNER/REPO.","If you have a URL, pass the URL itself; the finder routes by shape."],"exampleFix":"# before\ngh pr view \"acme#123\"  # invalid reference\n\n# after\ngh pr view \"acme/widgets#123\"","handlingStrategy":"validation","validationCode":"var refRE = regexp.MustCompile(`^[^/]+/[^/]+#\\d+$`)\nfunc isValidFullReference(s string) bool { return refRE.MatchString(s) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use OWNER/REPO#N exactly; no scheme, no trailing punctuation.","For bare numbers, pair with --repo."],"tags":["validation","parsing","reference","user-input"],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}