{"record":{"id":"d4f9f9e9fa70fed2","repo":"docker/compose","slug":"format-value-q-could-not-be-parsed-w","errorCode":null,"errorMessage":"format value %q could not be parsed: %w","messagePattern":"format value %q could not be parsed: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/formatter/formatter.go","lineNumber":68,"sourceCode":"\t\t\t_, _ = fmt.Fprintln(outWriter, outJSON)\n\t\t}\n\tcase JSON:\n\t\tswitch reflect.TypeOf(toJSON).Kind() {\n\t\tcase reflect.Slice:\n\t\t\toutJSON, err := ToJSON(toJSON, \"\", \"\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, _ = fmt.Fprint(outWriter, outJSON)\n\t\tdefault:\n\t\t\toutJSON, err := ToStandardJSON(toJSON)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, _ = fmt.Fprintln(outWriter, outJSON)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"format value %q could not be parsed: %w\", format, api.ErrParsingFailed)\n\t}\n\treturn nil\n}\n","sourceCodeStart":50,"sourceCodeEnd":72,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/formatter/formatter.go#L50-L72","documentation":"Returned by formatter.Print (used by list-style commands such as `docker compose ls`, `ps`, `images` with --format) when the requested --format value matches none of the accepted cases: table/pretty/empty, the legacy 'json' TemplateLegacyJSON, or 'json' after strings.ToLower normalization — plus any command-specific template handling done before this call. The error wraps api.ErrParsingFailed and echoes the offending value so the user sees exactly what was rejected.","triggerScenarios":"Passing an unsupported format: `docker compose ls --format yaml`, `--format csv`, or a Go template string where templates are not supported for that command; case is normalized (JSON works), but any other token falls to the default branch and errors.","commonSituations":"Scripts assuming jq-style universal formats (yaml/csv); copy-pasting `--format '{{.Name}}'` from a command that supports templates into one routed through formatter.Print without template support; typos like `--format jso`; version drift where a format existed in another tool (docker CLI supports more formats).","solutions":["Use a supported value: `--format table` (default), `--format pretty`, or `--format json`.","For custom output, consume `--format json` and transform with jq/yq downstream.","Check the specific command's --help to see whether Go templates are accepted; if yes use `--format '{{...}}'`, else stick to json."],"exampleFix":"# before\ndocker compose ls --format yaml\n\n# after\ndocker compose ls --format json | yq -P","handlingStrategy":"validation","validationCode":"case \"$(echo \"$FMT\" | tr '[:upper:]' '[:lower:]')\" in\n  table|pretty|json|'') : ;;\n  *) echo \"unsupported --format: $FMT (use table|pretty|json)\" >&2; exit 2;;\nesac\ndocker compose ls --format \"$FMT\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin wrappers to --format json and post-process with jq/yq.","Check each command's --help before using templates or exotic formats.","Don't assume docker CLI format sets transfer to compose commands."],"tags":["cli","formatter","format","json","output","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}