{"id":"832b27018c5fb41f","repo":"docker/cli","slug":"cannot-supply-extra-formatting-options-to-the-pret","errorCode":null,"errorMessage":"cannot supply extra formatting options to the pretty template","messagePattern":"cannot supply extra formatting options to the pretty template","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/config/inspect.go","lineNumber":61,"sourceCode":"}\n\n// runInspect inspects the given Swarm config.\nfunc runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {\n\tapiClient := dockerCLI.Client()\n\n\tif opts.pretty {\n\t\topts.format = \"pretty\"\n\t}\n\n\tgetRef := func(id string) (any, []byte, error) {\n\t\tres, err := apiClient.ConfigInspect(ctx, id, client.ConfigInspectOptions{})\n\t\treturn res.Config, res.Raw, err\n\t}\n\n\t// check if the user is trying to apply a template to the pretty format, which\n\t// is not supported\n\tif strings.HasPrefix(opts.format, \"pretty\") && opts.format != \"pretty\" {\n\t\treturn errors.New(\"cannot supply extra formatting options to the pretty template\")\n\t}\n\n\tconfigCtx := formatter.Context{\n\t\tOutput: dockerCLI.Out(),\n\t\tFormat: newFormat(opts.format, false),\n\t}\n\n\tif err := inspectFormatWrite(configCtx, opts.names, getRef); err != nil {\n\t\treturn cli.StatusError{StatusCode: 1, Status: err.Error()}\n\t}\n\treturn nil\n}\n","sourceCodeStart":43,"sourceCodeEnd":74,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/config/inspect.go#L43-L74","documentation":"Raised by runInspect in cli/command/config/inspect.go when the --format value starts with \"pretty\" but is not exactly \"pretty\". The pretty formatter is a fixed built-in template for human-readable output; it cannot be combined with additional Go-template directives, so the CLI rejects the mixed format string instead of producing broken output.","triggerScenarios":"Running `docker config inspect --format 'pretty{{.Spec.Name}}' myconfig` or any --format value that begins with the literal \"pretty\" followed by extra text; also combining --pretty with a custom --format that then gets normalized into such a string.","commonSituations":"Users assuming pretty is a modifier they can stack with a template (\"pretty + just this field\"); scripts concatenating format fragments where one fragment is 'pretty'; the same guard exists for secret/node inspect, so the confusion often carries over between commands.","solutions":["Use either `--pretty` (or `--format pretty`) alone for the human-readable view, or a pure Go template like `--format '{{.Spec.Name}}'` — never both.","If you need specific fields, drop pretty and write the template for exactly those fields, optionally piped through `docker inspect -f` conventions.","For machine-readable output use `--format json` and post-process with jq."],"exampleFix":"# before\ndocker config inspect --format 'pretty {{.Spec.Name}}' app-config\n# after (pick one)\ndocker config inspect --pretty app-config\ndocker config inspect --format '{{.Spec.Name}}' app-config","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","formatting","go-templates","swarm-config"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}