glanceapp/glance · error
unknown command: %s
Error message
unknown command: %s
What it means
Returned by the CLI arg parser in internal/glance/cli.go when the positional arguments after flag parsing do not match any known subcommand (config:validate, config:print, sensors:print, diagnose, mountpoint:info variants) and are not a single file path (serve intent). The error message joins all remaining args with spaces, e.g. `unknown command: servre`.
Source
Thrown at internal/glance/cli.go:68
fmt.Println("\nCommands:")
fmt.Println(" config:validate Validate the config file")
fmt.Println(" config:print Print the parsed config file with embedded includes")
fmt.Println(" password:hash <pwd> Hash a password")
fmt.Println(" secret:make Generate a random secret key")
fmt.Println(" sensors:print List all sensors")
fmt.Println(" mountpoint:info Print information about a given mountpoint path")
fmt.Println(" diagnose Run diagnostic checks")
}
configPath := flags.String("config", "glance.yml", "Set config path")
err := flags.Parse(os.Args[1:])
if err != nil {
return nil, err
}
var intent cliIntent
args = flags.Args()
unknownCommandErr := fmt.Errorf("unknown command: %s", strings.Join(args, " "))
if len(args) == 0 {
intent = cliIntentServe
} else if len(args) == 1 {
if args[0] == "config:validate" {
intent = cliIntentConfigValidate
} else if args[0] == "config:print" {
intent = cliIntentConfigPrint
} else if args[0] == "sensors:print" {
intent = cliIntentSensorsPrint
} else if args[0] == "diagnose" {
intent = cliIntentDiagnose
} else if args[0] == "secret:make" {
intent = cliIntentSecretMake
} else {
return nil, unknownCommandErr
}
} else if len(args) == 2 {View on GitHub (pinned to 91324e8de7)
Solutions
- Run `glance --help` (or glance with no args) and use one of the listed commands: config:validate, config:print, sensors:print, diagnose, mountpoint:info.
- For config checking use `glance config:validate --config glance.yml`.
- Fix typos: the command is `config:validate`, not `validate` or `check`.
- If you intended to serve a file, pass just the config path as the single positional argument.
Example fix
# before $ glance validate --config glance.yml # after $ glance config:validate --config glance.yml
Defensive patterns
Strategy: validation
Validate before calling
# shell: reject before running case "$1" in ""|config:validate|config:print|sensors:print|diagnose|mountpoint:info) glance "$@" ;; *) echo "unknown command: $1"; glance --help; exit 1 ;; esac
Prevention
- Run `glance --help` first; commands are config:validate, config:print, sensors:print, diagnose, mountpoint:info.
- Wrap glance invocations in scripts that verify subcommands before deploy.
When it happens
Trigger: Running `glance servre`, `glance check config`, `glance --config glance.yml frobnicate`, or passing multiple unexpected positionals. Also when flags come after the subcommand in a way flag.Parse leaves unexpected Args behind.
Common situations: Typos in subcommands (`validate` instead of `config:validate`); assuming CLI verbs that don't exist; old scripts written against different tooling; copy-pasting commands from outdated docs.
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/a66e20468a9e6c13.
Report an issue: GitHub.