mislav/hub · error
%s %s
Error message
%s %s
What it means
In commands/commands.go parseArguments, the flag parser (args.Flag.Parse) fails on the supplied arguments (unknown flag, missing value, bad syntax). The returned error is wrapped with the command's synopsis so the user sees the parse error followed by usage text.
Source
Thrown at commands/commands.go:67
type ErrHelp struct {
err string
}
func (e ErrHelp) Error() string {
return e.err
}
func (c *Command) parseArguments(args *Args) error {
knownFlags := c.KnownFlags
if knownFlags == "" {
knownFlags = c.Long
}
args.Flag = utils.NewArgsParserWithUsage("-h, --help\n" + knownFlags)
rest, err := args.Flag.Parse(args.Params)
if err != nil {
return fmt.Errorf("%s\n%s", err, c.Synopsis())
}
if args.Flag.Bool("--help") {
return &ErrHelp{err: c.Synopsis()}
}
args.Params = rest
args.Terminator = args.Flag.HasTerminated
return nil
}
func (c *Command) Use(subCommand *Command) {
if c.subCommands == nil {
c.subCommands = make(map[string]*Command)
}
c.subCommands[subCommand.Name()] = subCommand
subCommand.parentCommand = c
}
func (c *Command) UsageError(msg string) error {View on GitHub (pinned to 5c547ed804)
Solutions
- Read the usage block printed after the error and correct the flag name/value.
- Run the command with `-h/--help` to list valid flags.
- If a flag seems valid but rejected, check your hub version (`hub version`) and upgrade.
Example fix
// before hub pull-request --recurse-submodules // flag parse error + usage // after hub pull-request --base master --message "PR title"
Defensive patterns
Strategy: validation
Validate before calling
// validate args against the parser before invoking
flags := utils.NewArgsParserWithUsage("-h, --help\n" + knownFlags)
if _, err := flags.Parse(os.Args[1:]); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
} Try / catch
rest, err := args.Flag.Parse(args.Params)
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n%s\n", err, c.Synopsis())
os.Exit(1)
} Prevention
- Run commands with --help to confirm flag names before use
- Quote shell arguments containing spaces or special chars
- Pin and keep hub updated so flag names match documentation
When it happens
Trigger: Calling the command with an unrecognized flag, a flag missing its required value, malformed `--flag=value` syntax, or flags placed after a terminator, making args.Flag.Parse(args.Params) return a non-nil error.
Common situations: Typo in a flag name (`--recursion` vs `--recursive`); using a flag not supported by the installed hub version; passing flags after positional args when the parser doesn't allow it; scripting the CLI with quoting mistakes.
Related errors
- %s%s%s
- Error: couldn't detect shell type. Please specify your shell
- hub alias: unsupported shell supported shells: %s
- Unsupported flag -b when checking out pull request
- Unsupported flag --orphan when checking out pull request
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/d7539b7d1847e4aa.
Report an issue: GitHub.