{"record":{"id":"1f558ea2e175239e","repo":"argoproj/argo-workflows","slug":"unknown-output-mode-s-1f558e","errorCode":null,"errorMessage":"unknown output mode: %s","messagePattern":"unknown output mode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/printer/workflow-printer.go","lineNumber":49,"sourceCode":"\t\tprintCostOptimizationNudges(workflows, out)\n\tcase \"name\":\n\t\tfor _, wf := range workflows {\n\t\t\t_, _ = fmt.Fprintln(out, wf.Name)\n\t\t}\n\tcase \"json\":\n\t\toutput, err := json.MarshalIndent(workflows, \"\", \"  \")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, _ = fmt.Fprintln(out, string(output))\n\tcase \"yaml\":\n\t\toutput, err := yaml.Marshal(workflows)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, _ = fmt.Fprintln(out, string(output))\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown output mode: %s\", opts.Output)\n\t}\n\treturn nil\n}\n\ntype PrintOpts struct {\n\tNoHeaders bool\n\tNamespace bool\n\tOutput    string\n\tUID       bool\n}\n\nfunc printTable(wfList []wfv1.Workflow, out io.Writer, opts PrintOpts) {\n\tw := tabwriter.NewWriter(out, 0, 0, 3, ' ', 0)\n\tif !opts.NoHeaders {\n\t\tif opts.Namespace {\n\t\t\t_, _ = fmt.Fprint(w, \"NAMESPACE\\t\")\n\t\t}\n\t\t_, _ = fmt.Fprint(w, \"NAME\\tSTATUS\\tAGE\\tDURATION\\tPRIORITY\\tMESSAGE\")","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/printer/workflow-printer.go#L31-L67","documentation":"PrintWorkflows renders workflows according to PrintOpts.Output; recognized modes are name, wide, json, and yaml (with the empty string meaning the default table). Any other value hits the default branch and returns this error, so the CLI fails fast instead of printing an unexpected format.","triggerScenarios":"Running `argo list -o <bad>` (e.g. `-o table`, `-o csv`, `-o yaml` with a typo like `-o yml`) or programmatically passing PrintOpts{Output: \"yaml \"} with stray characters.","commonSituations":"Muscle memory from kubectl's -o flag values (table/columns/custom-columns) that Argo does not implement; typos like yml vs yaml; scripts interpolating an empty or malformed output variable.","solutions":["Use a supported value: (empty for default table), name, wide, json, or yaml.","Replace -o yml with -o yaml.","For CSV or custom formats, use -o json and transform with jq.","Validate the flag in scripts: case/whitelist before invoking the CLI."],"exampleFix":"# before\nargo list -o yml > out.yaml\n# after\nargo list -o yaml > out.yaml","handlingStrategy":"validation","validationCode":"var validOutputs = map[string]bool{\"\": true, \"name\": true, \"wide\": true, \"json\": true, \"yaml\": true}\nfunc outputValid(o string) bool { return validOutputs[o] }","typeGuard":null,"tryCatchPattern":"if err := printer.PrintWorkflows(ctx, wfs, out, opts); err != nil {\n    if strings.HasPrefix(err.Error(), \"unknown output mode\") {\n        return fmt.Errorf(\"-o must be one of name|wide|json|yaml: %w\", err)\n    }\n    return err\n}","preventionTips":["Only pass -o values from {name, wide, json, yaml} in scripts and CI.","Use -o json plus jq for any custom/CSV formatting.","Validate the flag with a whitelist before exec'ing the CLI."],"tags":["go","cli","output-format"],"backgroundTag":"invalid-output-format","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}