cli/cli · warning
agent tasks are not supported on this host
Error message
agent tasks are not supported on this host
What it means
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.
Source
Thrown at pkg/cmd/agent-task/agent_task.go:84
return cmd
}
// requireOAuthToken ensures an OAuth (device flow) token is present and valid.
// agent-task subcommands inherit this check via PersistentPreRunE.
func requireOAuthToken(f *cmdutil.Factory) error {
cfg, err := f.Config()
if err != nil {
return err
}
authCfg := cfg.Authentication()
host, _ := authCfg.DefaultHost()
if host == "" {
return errors.New("no default host configured; run 'gh auth login'")
}
if auth.IsEnterprise(host) {
return errors.New("agent tasks are not supported on this host")
}
token, source := authCfg.ActiveToken(host)
// Tokens from sources "oauth_token" and "keyring" are likely
// minted through our device flow.
tokenSourceIsDeviceFlow := source == "oauth_token" || source == "keyring"
// Tokens with "gho_" prefix are OAuth tokens.
tokenIsOAuth := strings.HasPrefix(token, "gho_")
// Reject if the token is not from a device flow source or is not an OAuth token
if !tokenSourceIsDeviceFlow || !tokenIsOAuth {
return fmt.Errorf("this command requires an OAuth token. Re-authenticate with: gh auth login")
}
return nil
}
View on GitHub (pinned to 0eeec0b92e)
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.
Example fix
# before gh pr view "acme#123" # invalid reference # after gh pr view "acme/widgets#123"
Defensive patterns
Strategy: validation
Validate before calling
var refRE = regexp.MustCompile(`^[^/]+/[^/]+#\d+$`)
func isValidFullReference(s string) bool { return refRE.MatchString(s) } Prevention
- Use OWNER/REPO#N exactly; no scheme, no trailing punctuation.
- For bare numbers, pair with --repo.
When it happens
Trigger: 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!'.
Common situations: Users pasting URLs or bare numbers where the CLI documents the OWNER/REPO#N form; scripts concatenating slug and number with the wrong separator.
Related errors
- username cannot be blank
- invalid hostname
- ErrNotFound
- no default host configured; run 'gh auth login'
- task description file cannot be empty
AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15).
Data as JSON: /api/errors/1c4defd36b63a901.
Report an issue: GitHub.