{"record":{"id":"1b56af7eb960939c","repo":"lima-vm/lima","slug":"unexpected-option-q","errorCode":null,"errorMessage":"unexpected option %#q","messagePattern":"unexpected option %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sshutil/format.go","lineNumber":97,"sourceCode":"\t\targs = append(args, fakeHostname)\n\t\t// the args are similar to `limactl shell` but not exactly same. (e.g., lacks -t)\n\t\tfmt.Fprintln(w, strings.Join(args, \" \")) // no need to use shellescape.QuoteCommand\n\tcase FormatArgs:\n\t\tvar args []string\n\t\tfor _, o := range opts {\n\t\t\targs = append(args, \"-o\", quoteOption(o))\n\t\t}\n\t\tfmt.Fprintln(w, strings.Join(args, \" \")) // no need to use shellescape.QuoteCommand\n\tcase FormatOptions:\n\t\tfor _, o := range opts {\n\t\t\tfmt.Fprintln(w, o)\n\t\t}\n\tcase FormatConfig:\n\t\tfmt.Fprintf(w, \"Host %s\\n\", fakeHostname)\n\t\tfor _, o := range opts {\n\t\t\tkv := strings.SplitN(o, \"=\", 2)\n\t\t\tif len(kv) != 2 {\n\t\t\t\treturn fmt.Errorf(\"unexpected option %#q\", o)\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \"  %s %s\\n\", kv[0], kv[1])\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown format: %#q\", format)\n\t}\n\treturn nil\n}\n","sourceCodeStart":79,"sourceCodeEnd":106,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/sshutil/format.go#L79-L106","documentation":"When formatting as an ssh_config block, each option must be a key=value string (split on the first '='). An option without '=' cannot be rendered as a config directive, so Format rejects it. This preserves the invariant that every opts entry maps to one 'Key Value' line in the config.","triggerScenarios":"Calling sshutil.Format with format=FormatConfig and an opts element lacking '=', e.g. \"ForwardAgent yes\" (space-separated) or a bare flag like \"-v\" instead of \"ForwardAgent=yes\".","commonSituations":"Hand-building the opts slice with CLI-style syntax instead of key=value pairs; copying options that were meant for FormatCmd into a FormatConfig call; typos such as missing '='.","solutions":["Rewrite each option as key=value, e.g. \"ForwardAgent=yes\" instead of \"ForwardAgent yes\".","Check which formatter you need: FormatCmd accepts plain option strings, FormatConfig requires key=value.","Trim whitespace and inspect the offending option printed in the error for a missing '='."],"exampleFix":"// before\nopts := []string{\"ForwardAgent yes\", \"StrictHostKeyChecking no\"}\nsshutil.Format(w, sshPath, instName, sshutil.FormatConfig, opts)\n// after\nopts := []string{\"ForwardAgent=yes\", \"StrictHostKeyChecking=no\"}\nsshutil.Format(w, sshPath, instName, sshutil.FormatConfig, opts)","handlingStrategy":"validation","validationCode":"for _, o := range opts {\n    if !strings.Contains(o, \"=\") {\n        return fmt.Errorf(\"option %q must be key=value for FormatConfig\", o)\n    }\n}","typeGuard":"func isKVOption(o string) bool { return strings.Contains(o, \"=\") }","tryCatchPattern":"if err := sshutil.Format(w, sshPath, instName, sshutil.FormatConfig, opts); err != nil {\n    if strings.Contains(err.Error(), \"unexpected option\") {\n        // convert opts to key=value form and retry\n    }\n}","preventionTips":["Always build opts as key=value pairs when targeting FormatConfig","Use the same opts-construction helper for cmd and config formats","Add a unit test asserting every option contains '='"],"tags":["ssh","format","malformed-option"],"backgroundTag":"ssh-option-format-invalid","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}