{"id":"f3035d87c04e6848","repo":"docker/cli","slug":"cannot-supply-extra-formatting-options-to-the-pret-f3035d","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/service/inspect.go","lineNumber":88,"sourceCode":"\t\tres, err := apiClient.NetworkInspect(ctx, ref, client.NetworkInspectOptions{Scope: \"swarm\"})\n\t\tif err == nil || !errdefs.IsNotFound(err) {\n\t\t\treturn res.Network, res.Raw, err\n\t\t}\n\t\treturn nil, nil, fmt.Errorf(\"no such network: %s\", ref)\n\t}\n\n\tf := opts.format\n\tif len(f) == 0 {\n\t\tf = \"raw\"\n\t\tif len(dockerCLI.ConfigFile().ServiceInspectFormat) > 0 {\n\t\t\tf = dockerCLI.ConfigFile().ServiceInspectFormat\n\t\t}\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(f, \"pretty\") && f != \"pretty\" {\n\t\treturn errors.New(\"cannot supply extra formatting options to the pretty template\")\n\t}\n\n\tserviceCtx := formatter.Context{\n\t\tOutput: dockerCLI.Out(),\n\t\tFormat: newFormat(f),\n\t}\n\n\tif err := inspectFormatWrite(serviceCtx, opts.refs, getRef, getNetwork); err != nil {\n\t\treturn cli.StatusError{StatusCode: 1, Status: err.Error()}\n\t}\n\treturn nil\n}\n","sourceCodeStart":70,"sourceCodeEnd":101,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/inspect.go#L70-L101","documentation":"Raised by `docker service inspect` when the resolved format string starts with \"pretty\" but is not exactly \"pretty\". The pretty template is a fixed built-in and cannot take extra Go-template directives. Note the format may come not only from --format but also from the `serviceInspectFormat` setting in ~/.docker/config.json.","triggerScenarios":"`docker service inspect --format 'pretty {{.ID}}' svc`, or a ~/.docker/config.json containing `\"serviceInspectFormat\": \"pretty ...\"` with trailing content, since that config value is used when --format is omitted.","commonSituations":"Users appending fields to the pretty template, or a malformed serviceInspectFormat entry in the docker client config causing every plain `docker service inspect` to fail unexpectedly.","solutions":["Use exactly `--format pretty` or the --pretty flag.","For custom fields, use a pure Go template without the 'pretty' prefix.","If the error occurs without --format, fix or remove `serviceInspectFormat` in ~/.docker/config.json."],"exampleFix":"// before (~/.docker/config.json)\n{\"serviceInspectFormat\": \"pretty {{.ID}}\"}\n// after\n{\"serviceInspectFormat\": \"pretty\"}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","swarm","services","formatting","go-template","client-config"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}