chenhg5/cc-connect · error
unknown option: %s
Error message
unknown option: %s
What it means
parseTuiTuiArgs has a fixed allow-list of flags; any unrecognized argument hits the default branch and returns "unknown option: %s". This is strict parsing — no prefix matching or abbreviation is supported.
Source
Thrown at cmd/cc-connect/tuitui.go:363
opts.channelID = v
case "--parent", "--parent-id":
v, err := value()
if err != nil {
return opts, err
}
opts.parentID = v
case "--message", "-m":
v, err := value()
if err != nil {
return opts, err
}
opts.message = v
case "--stdin":
opts.stdin = true
case "--help", "-h":
return opts, errTuiTuiUsage
default:
return opts, fmt.Errorf("unknown option: %s", arg)
}
}
if opts.configPath == "" {
opts.configPath = resolveConfigPath("")
}
return opts, nil
}
var errTuiTuiUsage = errors.New("show tuitui usage")
func loadTuiTuiPlatform(opts tuituiCLIOptions) (*tuitui.Platform, error) {
platformOpts := map[string]any{}
if opts.configPath != "" {
cfg, err := config.Load(opts.configPath)
if err != nil {
if opts.configSet {
return nil, err
}View on GitHub (pinned to 4000b2338a)
Solutions
- Check the flag list with --help/-h (which returns the usage via errTuiTuiUsage)
- Fix the typo in the flag name
- Remove unsupported positional arguments or quote values beginning with - as --flag=-value
Example fix
// before cc-connect tuitui post --maxbytes 100 // after cc-connect tuitui post --max-bytes 100
Defensive patterns
Strategy: validation
Validate before calling
allowed := map[string]bool{"--config":true, "--limit":true, "--max-bytes":true, "--project":true, "--help":true, "-h":true}
for _, a := range args {
if strings.HasPrefix(a, "-") && !allowed[a] {
return fmt.Errorf("unknown option %s (see --help)", a)
}
} Try / catch
opts, err := parseTuiTuiArgs(args)
if errors.Is(err, errTuiTuiUsage) {
printUsage(); os.Exit(0)
} else if err != nil {
fmt.Fprintln(os.Stderr, err); os.Exit(2)
} Prevention
- Run --help before inventing flag names
- Watch for flag renames across versions
- Don't mix flags between tuitui subcommands
When it happens
Trigger: Misspelled flags (--maxbytes, --limt), flags belonging to other subcommands, positional arguments passed where not supported, or a leading dash value like `--project -x`.
Common situations: Typo in flag name; mixing flags from the download subcommand into post; outdated muscle memory after a flag rename; running `cc-connect tuitui` with stray positional args.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- %s requires a value
- unknown flag: %s
- unknown top-level command: %s
- --image requires a path
- --file requires a path
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/8b2d10d5facd62c0.
Report an issue: GitHub.