{"record":{"id":"f5f4c78ffe553f8f","repo":"lima-vm/lima","slug":"unsupported-log-format-q","errorCode":null,"errorMessage":"unsupported log-format: %#q","messagePattern":"unsupported log-format: %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/main.go","lineNumber":98,"sourceCode":"\t\t}\n\t\tlogrus.SetLevel(lvl)\n\t}\n\n\tlogFormat, _ := rootCmd.Flags().GetString(\"log-format\")\n\tswitch logFormat {\n\tcase \"json\":\n\t\tformatter := new(logrus.JSONFormatter)\n\t\tlogrus.StandardLogger().SetFormatter(formatter)\n\tcase \"text\":\n\t\t// logrus use text format by default.\n\t\tif runtime.GOOS == \"windows\" && isatty.IsCygwinTerminal(os.Stderr.Fd()) {\n\t\t\tformatter := new(logrus.TextFormatter)\n\t\t\t// the default setting does not recognize cygwin on windows\n\t\t\tformatter.ForceColors = true\n\t\t\tlogrus.StandardLogger().SetFormatter(formatter)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported log-format: %#q\", logFormat)\n\t}\n\treturn nil\n}\n\nfunc newApp() *cobra.Command {\n\ttemplatesDir := \"$PREFIX/share/lima/templates\"\n\tif exe, err := os.Executable(); err == nil {\n\t\tbinDir := filepath.Dir(exe)\n\t\tprefixDir := filepath.Dir(binDir)\n\t\ttemplatesDir = filepath.Join(prefixDir, \"share/lima/templates\")\n\t}\n\n\trootCmd := &cobra.Command{\n\t\tUse:     \"limactl\",\n\t\tShort:   \"Lima: Linux virtual machines\",\n\t\tVersion: strings.TrimPrefix(version.Version, \"v\"),\n\t\tExample: fmt.Sprintf(`  Start the default instance:\n  $ limactl start","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/main.go#L80-L116","documentation":"limactl's --log-format global flag accepts a fixed set of formatter names (e.g. json, text). processGlobalFlags validates the value and returns this error from cmd/limactl/main.go:98 for anything unrecognized. It fails before any subcommand runs.","triggerScenarios":"`limactl --log-format <value> ...` where <value> is not one of the supported names (json/text); scripts passing an unset/empty variable as the flag value.","commonSituations":"Typo like --log-format=json-formatted or --logformat; copying a flag value from another tool; shell var expansion producing an empty string for the flag.","solutions":["Use an accepted value: `--log-format json` or omit the flag for the default text format","Check `limactl --help` for the exact list of supported log-format values","Quote the value in scripts to avoid stray whitespace"],"exampleFix":"// before\nlimactl --log-format=pretty list\n// after\nlimactl --log-format=json list","handlingStrategy":"validation","validationCode":"case \"$LOG_FORMAT\" in \"\"|json|text) ;; *) echo \"unsupported log-format: $LOG_FORMAT\" >&2; exit 1;; esac","typeGuard":null,"tryCatchPattern":"if err := processGlobalFlags(cmd); err != nil {\n\tif strings.HasPrefix(err.Error(), \"unsupported log-format\") {\n\t\tfmt.Fprintln(os.Stderr, \"use --log-format json or text\")\n\t\tos.Exit(2)\n\t}\n\treturn err\n}","preventionTips":["Only pass --log-format json (or the documented text default)","Check `limactl --help` for accepted values before scripting","Default expanded variables: LOG_FORMAT=\"${LOG_FORMAT:-json}\""],"tags":["cli","logging","flags"],"backgroundTag":"invalid-flag-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}