{"id":"7bb4174e5bcb3e89","repo":"docker/cli","slug":"cannot-supply-extra-formatting-options-to-the-pret-7bb417","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/node/inspect.go","lineNumber":65,"sourceCode":"\tapiClient := dockerCLI.Client()\n\n\tif opts.pretty {\n\t\topts.format = \"pretty\"\n\t}\n\n\tgetRef := func(ref string) (any, []byte, error) {\n\t\tnodeRef, err := Reference(ctx, apiClient, ref)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tres, err := apiClient.NodeInspect(ctx, nodeRef, client.NodeInspectOptions{})\n\t\treturn res.Node, 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\tnodeCtx := formatter.Context{\n\t\tOutput: dockerCLI.Out(),\n\t\tFormat: newFormat(opts.format, false),\n\t}\n\n\tif err := inspectFormatWrite(nodeCtx, opts.nodeIds, getRef); err != nil {\n\t\treturn cli.StatusError{StatusCode: 1, Status: err.Error()}\n\t}\n\treturn nil\n}\n","sourceCodeStart":47,"sourceCodeEnd":78,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/node/inspect.go#L47-L78","documentation":"Raised by `docker node inspect` when the --format value starts with 'pretty' but is not exactly 'pretty'. The pretty output is a fixed human-readable template, so appending Go-template directives to it is unsupported and rejected before any API call.","triggerScenarios":"`docker node inspect --format 'pretty{{.ID}}' mynode` or any --format string with the 'pretty' prefix plus extra text; combining --pretty semantics with a custom template.","commonSituations":"Users trying to tweak the pretty output with template fields; scripts concatenating format fragments onto 'pretty'; confusion between --pretty flag and --format template.","solutions":["Use --format pretty (or the --pretty flag) alone for the human-readable view","Use a pure Go template for custom output, e.g. --format '{{.ID}} {{.Status.State}}'","Drop --format entirely to get raw JSON and post-process with jq"],"exampleFix":"# before\ndocker node inspect --format 'pretty {{.ID}}' node1\n# after\ndocker node inspect --format '{{.ID}}' node1   # or: --format pretty","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","swarm","node","formatting","go-template"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}