{"record":{"id":"cf4203e7cb5ec201","repo":"lima-vm/lima","slug":"unknown-format-q","errorCode":null,"errorMessage":"unknown format: %#q","messagePattern":"unknown format: %#q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sshutil/format.go","lineNumber":102,"sourceCode":"\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":84,"sourceCodeEnd":106,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/sshutil/format.go#L84-L106","documentation":"The requested output format for formatting an SSH command/config string is not recognized (expected values like `cmd` or `args`).","triggerScenarios":"Passing a FormatT value that is neither \"cmd\" nor \"config\" (zero-value struct/empty string, wrong constant, or a value produced by unvalidated user input) to sshutil.Format.","commonSituations":"Constructing FormatT from CLI flags or config files without validation; refactoring that renames the constants; uninitialized variables defaulting to the zero value.","solutions":["Use the exported constants sshutil.FormatCmd or sshutil.FormatConfig instead of raw strings.","Validate any externally sourced format value against the supported set before calling Format.","Check for an uninitialized/zero-valued FormatT variable at the call site."],"exampleFix":"// before\nvar format sshutil.FormatT\nsshutil.Format(w, sshPath, instName, format, opts) // \"unknown format\"\n// after\nformat := sshutil.FormatConfig\nsshutil.Format(w, sshPath, instName, format, opts)","handlingStrategy":"validation","validationCode":"if format != sshutil.FormatCmd && format != sshutil.FormatConfig {\n    return fmt.Errorf(\"unsupported format %q\", format)\n}","typeGuard":"func validFormat(f sshutil.FormatT) bool { return f == sshutil.FormatCmd || f == sshutil.FormatConfig }","tryCatchPattern":"if err := sshutil.Format(w, sshPath, instName, format, opts); err != nil {\n    if strings.Contains(err.Error(), \"unknown format\") {\n        // fall back to sshutil.FormatConfig\n    }\n}","preventionTips":["Only use exported FormatT constants","Validate CLI/config-sourced format values before calling Format","Avoid zero-valued FormatT variables"],"tags":["ssh","invalid-argument","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}