{"record":{"id":"981615eeed0ab032","repo":"slackhq/nebula","slug":"unknown-mode-s","errorCode":null,"errorMessage":"unknown mode: %s","messagePattern":"unknown mode: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/nebula-cert/main.go","lineNumber":93,"sourceCode":"\t\thandleError(args[0], &helpError{}, os.Stderr)\n\t\tos.Exit(0)\n\t}\n\n\tvar err error\n\n\tswitch args[0] {\n\tcase \"ca\":\n\t\terr = ca(args[1:], os.Stdout, os.Stderr, StdinPasswordReader{})\n\tcase \"keygen\":\n\t\terr = keygen(args[1:], os.Stdout, os.Stderr)\n\tcase \"sign\":\n\t\terr = signCert(args[1:], os.Stdout, os.Stderr, StdinPasswordReader{})\n\tcase \"print\":\n\t\terr = printCert(args[1:], os.Stdout, os.Stderr)\n\tcase \"verify\":\n\t\terr = verify(args[1:], os.Stdout, os.Stderr)\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown mode: %s\", args[0])\n\t}\n\n\tif err != nil {\n\t\tos.Exit(handleError(args[0], err, os.Stderr))\n\t}\n}\n\nfunc handleError(mode string, e error, out io.Writer) int {\n\tcode := 1\n\n\t// Handle -help, -h flags properly\n\tif e == flag.ErrHelp {\n\t\tcode = 0\n\t\te = &helpError{}\n\t} else if e != nil && e.Error() != \"\" {\n\t\tfmt.Fprintln(out, \"Error:\", e)\n\t}\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/cmd/nebula-cert/main.go#L75-L111","documentation":"main dispatches on the first CLI argument (the sub-command name). If args[0] is not one of the known modes (keygen, ca, sign, print, verify, etc.) it returns this error, then handleError prints it and os.Exit uses its result as the exit code. It is purely a CLI usage error, not a data or environment failure.","triggerScenarios":"invoking `nebula-cert <word> ...` where <word> does not match any case in the switch in main (e.g. a typo like `nebula-cert gnerate` or an unsupported sub-command)","commonSituations":"typos in the sub-command; scripts written for a different tool version that had different commands; copy-pasted commands from documentation of another binary","solutions":["Re-check the spelling of the sub-command (keygen, ca, sign, print, verify)","Run `nebula-cert` with no arguments to print usage","Check `nebula-cert -version` and the docs for your version's supported sub-commands","Update the binary if the command you need was added in a newer version"],"exampleFix":"// before\nnebula-cert generate -ca-crt ca.crt -name test\n// after\nnebula-cert sign -ca-crt ca.crt -name test","handlingStrategy":"validation","validationCode":"modes := map[string]bool{\"keygen\": true, \"ca\": true, \"sign\": true, \"print\": true, \"verify\": true}\nif len(os.Args) > 1 && !modes[os.Args[1]] {\n    fmt.Fprintf(os.Stderr, \"unknown mode %q; expected one of keygen|ca|sign|print|verify\\n\", os.Args[1])\n    os.Exit(2)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the sub-command against the known list before invoking","Run the binary bare to see usage output","Pin the nebula-cert version your scripts target","Shell-complete or script constants instead of hand-typed commands"],"tags":["cli","usage","nebula-cert"],"backgroundTag":"invalid-cli-argument","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}