{"record":{"id":"e35661f357cbe283","repo":"docker/cli","slug":"unknown-type-q-must-be-one-of-s","errorCode":null,"errorMessage":"unknown type: %q: must be one of \"%s\"","messagePattern":"unknown type: %q: must be one of \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/system/inspect.go","lineNumber":95,"sourceCode":"\n\tflags := cmd.Flags()\n\tflags.StringVarP(&opts.format, \"format\", \"f\", \"\", flagsHelper.InspectFormatHelp)\n\tflags.StringVar(&opts.objectType, \"type\", \"\", \"Only inspect objects of the given type\")\n\tflags.BoolVarP(&opts.size, \"size\", \"s\", false, \"Display total file sizes if the type is container\")\n\n\t_ = cmd.RegisterFlagCompletionFunc(\"type\", completion.FromList(allTypes...))\n\n\treturn cmd\n}\n\nfunc runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions) error {\n\tvar elementSearcher inspect.GetRefFunc\n\tswitch opts.objectType {\n\tcase \"\", typeConfig, typeContainer, typeImage, typeNetwork, typeNode,\n\t\ttypePlugin, typeSecret, typeService, typeTask, typeVolume:\n\t\telementSearcher = inspectAll(ctx, dockerCli, opts.size, opts.objectType)\n\tdefault:\n\t\treturn fmt.Errorf(`unknown type: %q: must be one of \"%s\"`, opts.objectType, strings.Join(allTypes, `\", \"`))\n\t}\n\treturn inspect.Inspect(dockerCli.Out(), opts.ids, opts.format, elementSearcher)\n}\n\nfunc inspectContainers(ctx context.Context, dockerCli command.Cli, getSize bool) inspect.GetRefFunc {\n\treturn func(ref string) (any, []byte, error) {\n\t\tres, err := dockerCli.Client().ContainerInspect(ctx, ref, client.ContainerInspectOptions{Size: getSize})\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn res.Container, res.Raw, err\n\t}\n}\n\nfunc inspectImages(ctx context.Context, dockerCli command.Cli) inspect.GetRefFunc {\n\treturn func(ref string) (any, []byte, error) {\n\t\tvar buf bytes.Buffer\n\t\tresp, err := dockerCli.Client().ImageInspect(ctx, ref, client.ImageInspectWithRawResponse(&buf))","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/system/inspect.go#L77-L113","documentation":"Returned by 'docker inspect --type <X>' when <X> is non-empty but not one of the recognized object types. The switch at inspect.go:90-96 falls through to default for anything not in {config, container, image, network, node, plugin, secret, service, task, volume}.","triggerScenarios":"Running 'docker inspect --type pod <id>' or --type containers (plural), --type image-file, etc. Any unrecognized type token reaches the default branch.","commonSituations":"Using a Kubernetes term (pod, deployment); plural form (containers instead of container); typo; version skew where a type exists in a newer CLI but not this one.","solutions":["Use one of the listed types exactly (singular): container, image, network, node, plugin, secret, service, task, volume, config.","Run 'docker inspect --help' to see the types supported by your CLI version.","Drop --type to let inspect search across all object kinds."],"exampleFix":"# before\ndocker inspect --type containers myid\n\n# after\ndocker inspect --type container myid\n# -or-\ndocker inspect myid","handlingStrategy":"type-guard","validationCode":"// Validate type against known set\nknown := map[string]bool{\"config\": true, \"container\": true, \"image\": true, \"network\": true, \"node\": true, \"plugin\": true, \"secret\": true, \"service\": true, \"task\": true, \"volume\": true}\nif !known[opts.objectType] {\n    return fmt.Errorf(\"unknown type %q\", opts.objectType)\n}","typeGuard":"func isKnownInspectType(t string) bool {\n\tswitch t {\n\tcase \"\", typeConfig, typeContainer, typeImage, typeNetwork, typeNode, typePlugin, typeSecret, typeService, typeTask, typeVolume:\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Use singular type names exactly as documented.","Run 'docker inspect --help' for the version's supported types.","Drop --type to search all kinds."],"tags":["inspect","type","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}