{"record":{"id":"afb70aeedbcc85f9","repo":"mikefarah/yq","slug":"no-support-for-output-format","errorCode":null,"errorMessage":"no support for output format","messagePattern":"no support for output format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_encoder_decoder.go","lineNumber":40,"sourceCode":"\t\tvar prefs = ConfiguredYamlPreferences.Copy()\n\t\tprefs.Indent = indent\n\t\tprefs.ColorsEnabled = false\n\t\treturn NewYamlEncoder(prefs)\n\tcase XMLFormat:\n\t\tvar xmlPrefs = ConfiguredXMLPreferences.Copy()\n\t\txmlPrefs.Indent = indent\n\t\treturn NewXMLEncoder(xmlPrefs)\n\t}\n\treturn format.EncoderFactory()\n}\n\nfunc encodeToString(candidate *CandidateNode, prefs encoderPreferences) (string, error) {\n\tvar output bytes.Buffer\n\tlog.Debugf(\"printing with indent: %v\", prefs.indent)\n\n\tencoder := configureEncoder(prefs.format, prefs.indent)\n\tif encoder == nil {\n\t\treturn \"\", errors.New(\"no support for output format\")\n\t}\n\n\tprinter := NewPrinter(encoder, NewSinglePrinterWriter(bufio.NewWriter(&output)))\n\terr := printer.PrintResults(candidate.AsList())\n\treturn output.String(), err\n}\n\ntype encoderPreferences struct {\n\tformat *Format\n\tindent int\n}\n\n/* encodes object as yaml string */\nvar chomper = regexp.MustCompile(\"\\n+$\")\n\nfunc encodeOperator(_ *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {\n\tpreferences := expressionNode.Operation.Preferences.(encoderPreferences)\n\tvar results = list.New()","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_encoder_decoder.go#L22-L58","documentation":"yq's encode operator looks up an Encoder for the requested output format via configureEncoder(). If the format string doesn't match any registered format, or the format is encoder-only-unsupported (e.g. built with a build tag that excludes it, like yq_noxml, so the factory returns nil), encodeToString returns this error. It means the library cannot serialize to the requested format in this binary.","triggerScenarios":"Running `yq -o <fmt>` (or encode_xml / to_json style operators) with a misspelled or unsupported format name; using a slim build compiled with `yq_no<format>` tags where that encoder's factory returns nil; calling encode with a format registered with a nil encoder factory.","commonSituations":"Typo in -o flag (e.g. `-o yml` instead of `-o yaml` in versions without that alias); using a small/tiny build (build_small-yq.sh / tinygo) that strips format support; older yq versions lacking a newer format like HCL or CSV.","solutions":["Check the format name against `yq --help` output and use an exact supported value (yaml, json, xml, csv, tsv, props, etc.).","If using a reduced build, rebuild yq without the yq_no<format> build tag (full build: go build -o yq .).","Upgrade to a recent yq release if the required output format is newer than your binary."],"exampleFix":"// before\nyq -o yml '.' file.yaml\n// after\nyq -o yaml '.' file.yaml","handlingStrategy":"validation","validationCode":"const supported = [\"yaml\",\"y\",\"json\",\"j\",\"props\",\"p\",\"csv\",\"tsv\",\"xml\",\"c\",\"lua\"]\nif !supported.includes(formatName) {\n  throw new Error(`unsupported output format: ${formatName}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `yq --help` and copy the exact -o format names rather than typing from memory.","Pin the full yq build in CI if you need all formats (avoid small/tiny builds with stripped encoders).","Upgrade yq when a needed output format isn't recognized by your installed version."],"tags":["encoder","output-format","build-tags"],"backgroundTag":"unsupported-output-format","analyzedSha":"8b5af0694bb82b41d4ae180fac9972029066f90a","analyzedAt":"2026-09-05T10:57:22.766Z","contentChangedAt":"2026-09-05T10:57:22.766Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}