{"record":{"id":"64f694dffbecaa7a","repo":"docker/cli","slug":"invalid-pull-option-s-must-be-one-of-q-q-o","errorCode":null,"errorMessage":"invalid pull option: '%s': must be one of %q, %q or %q","messagePattern":"invalid pull option: '(.+?)': must be one of %q, %q or %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/create.go","lineNumber":388,"sourceCode":"\t\t}); err != nil {\n\t\t\tresponse.Warnings = append(response.Warnings, fmt.Sprintf(\"injecting docker config.json into container failed: %v\", err))\n\t\t}\n\t}\n\tfor _, w := range response.Warnings {\n\t\t_, _ = fmt.Fprintln(dockerCLI.Err(), \"WARNING:\", w)\n\t}\n\n\terr = containerIDFile.Write(response.ID)\n\treturn response.ID, err\n}\n\nfunc validatePullOpt(val string) error {\n\tswitch val {\n\tcase PullImageAlways, PullImageMissing, PullImageNever, \"\":\n\t\t// valid option, but nothing to do yet\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\n\t\t\t\"invalid pull option: '%s': must be one of %q, %q or %q\",\n\t\t\tval,\n\t\t\tPullImageAlways,\n\t\t\tPullImageMissing,\n\t\t\tPullImageNever,\n\t\t)\n\t}\n}\n\n// copyDockerConfigIntoContainer takes the client configuration and copies it\n// into the container.\n//\n// The path should be an absolute path in the container, commonly\n// /root/.docker/config.json.\nfunc copyDockerConfigIntoContainer(ctx context.Context, apiClient client.APIClient, containerID string, configPath string, config *configfile.ConfigFile) error {\n\tvar configBuf bytes.Buffer\n\tif err := config.SaveToWriter(&configBuf); err != nil {\n\t\treturn fmt.Errorf(\"saving creds: %w\", err)","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/create.go#L370-L406","documentation":"Returned by validatePullOpt() when the --pull flag passed to `docker create`/`docker run` is not one of the recognized literals. The accepted values are defined as constants in create.go: \"always\", \"missing\" (the default), \"never\", or the empty string (meaning unset). Any other string is rejected before the container is created so that image-pull behavior stays well-defined.","triggerScenarios":"Passing `docker run --pull bogus nginx` or any value to the `--pull` flag that is not exactly \"always\", \"missing\", \"never\", or empty. The switch in validatePullOpt falls into the default branch and wraps the value in a fmt.Errorf.","commonSituations":"Typo in a script (e.g. --pull yes, --pull true, --pull all), copy-paste from docs that use non-canonical wording, or a wrapper that interpolates an unset variable producing an empty-but-quoted token.","solutions":["Set --pull to one of: always, missing, or never (or omit the flag, which is equivalent to missing).","If the value comes from a variable, default empty to \"missing\": --pull=${PULL:-missing}.","Check for typos such as --pull=Allways or --pull=mising."],"exampleFix":"# before\ndocker run --pull yes nginx\n\n# after\ndocker run --pull always nginx","handlingStrategy":"validation","validationCode":"var validPull = map[string]bool{\"always\": true, \"missing\": true, \"never\": true, \"\": true}\nfunc validatePull(v string) error {\n    if !validPull[v] {\n        return fmt.Errorf(\"invalid pull option: %q (want always|missing|never)\", v)\n    }\n    return nil\n}\n// call before invoking the run/create path with --pull","typeGuard":null,"tryCatchPattern":"// Go CLI errors are returned, not thrown. Inspect the returned error and\n// surface a usage hint:\nif err := cmd.Execute(); err != nil {\n    if strings.Contains(err.Error(), \"invalid pull option\") {\n        fmt.Fprintln(os.Stderr, \"--pull must be one of: always, missing, never\")\n    }\n    os.Exit(1)\n}","preventionTips":["Validate --pull against the constant set before invoking docker.","Default unset variables to 'missing' when interpolating into the flag.","Document the canonical values in wrapper scripts."],"tags":["container","cli","flag-validation","create"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}