{"record":{"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/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/node/inspect.go#L47-L78","documentation":"Thrown by runInspect when the resolved --format string starts with the prefix 'pretty' but is not exactly equal to 'pretty'. This prevents combining the built-in human-friendly pretty template with custom Go template directives, which is unsupported. Note that passing --pretty sets the format to exactly 'pretty'.","triggerScenarios":"Running 'docker node inspect' with a format string like '--format \"pretty {{.ID}}\"', or supplying both --pretty and a custom --format (line 64: HasPrefix(format,'pretty') && format != 'pretty').","commonSituations":"Trying to add fields to the pretty output; combining --pretty with --format; copy-pasting a template that begins with the word 'pretty'.","solutions":["Use --pretty alone for human-readable output, with no --format flag.","Use a fully custom --format Go template without the 'pretty' prefix.","Remove any leading 'pretty' token from your --format string."],"exampleFix":"# before\ndocker node inspect --format 'pretty {{.ID}}' self\n# after\ndocker node inspect --pretty self\n#   or\ndocker node inspect --format '{{.ID}}' self","handlingStrategy":"validation","validationCode":"// Disallow mixing 'pretty' with extra template text before running inspect\nif strings.HasPrefix(format, \"pretty\") && format != \"pretty\" {\n    return fmt.Errorf(\"use --pretty alone or a custom --format without the 'pretty' prefix\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine --pretty with a custom --format string.","If you need specific fields, write a full Go template without the 'pretty' token.","Treat 'pretty' as a reserved mode, not a composable prefix."],"tags":["node","inspect","format","docker","go","cli"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}