{"record":{"id":"c200871ebd1b7d9c","repo":"docker/cli","slug":"you-must-provide-one-or-more-flags-when-using-this","errorCode":null,"errorMessage":"you must provide one or more flags when using this command","messagePattern":"you must provide one or more flags when using this command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/update.go","lineNumber":95,"sourceCode":"\n\tflags.Var(&options.cpus, \"cpus\", \"Number of CPUs\")\n\t_ = flags.SetAnnotation(\"cpus\", \"version\", []string{\"1.29\"})\n\n\t_ = cmd.RegisterFlagCompletionFunc(\"restart\", completeRestartPolicies)\n\n\t// TODO(thaJeztah): remove in next release (v30.0, or v29.x)\n\tvar stub opts.MemBytes\n\tflags.Var(&stub, \"kernel-memory\", \"Kernel memory limit (deprecated)\")\n\t_ = flags.MarkDeprecated(\"kernel-memory\", \"and no longer supported by the kernel\")\n\n\treturn cmd\n}\n\nfunc runUpdate(ctx context.Context, dockerCli command.Cli, options *updateOptions) error {\n\tvar err error\n\n\tif options.nFlag == 0 {\n\t\treturn errors.New(\"you must provide one or more flags when using this command\")\n\t}\n\n\tvar restartPolicy containertypes.RestartPolicy\n\tif options.restartPolicy != \"\" {\n\t\trestartPolicy, err = opts.ParseRestartPolicy(options.restartPolicy)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar pidsLimit *int64\n\tif options.pidsLimit != 0 {\n\t\tpidsLimit = &options.pidsLimit\n\t}\n\n\tupdateConfig := client.ContainerUpdateOptions{\n\t\tResources: &containertypes.Resources{\n\t\t\tBlkioWeight:        options.blkioWeight,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/update.go#L77-L113","documentation":"Returned by runUpdate when options.nFlag is 0, meaning the user invoked `docker update` with no resource-limit flags at all. The update command's whole purpose is to change live container constraints (CPU, memory, restart policy, pids), so providing none is a no-op the CLI rejects early at update.go:94-96.","triggerScenarios":"`docker update c1` with no --memory, --cpus, --restart, --pids-limit, etc. nFlag counts changed flags; zero triggers the error.","commonSituations":"Forgetting the actual limit flag after the container name. Scripts building the flag list dynamically that produce an empty list. Trying to use `docker update` merely to inspect (wrong command).","solutions":["Add at least one resource flag, e.g. `docker update --cpus 2 c1` or `docker update --memory 512m c1`.","If scripting, ensure your flag builder appends at least one limit before invoking docker.","To inspect limits use `docker inspect`, not `docker update`."],"exampleFix":"// before\ndocker update c1\n\n// after\ndocker update --cpus 2 --memory 512m c1","handlingStrategy":"validation","validationCode":"func validateUpdate(changedFlags int) error {\n    if changedFlags == 0 {\n        return errors.New(\"you must provide one or more flags when using this command\")\n    }\n    return nil\n}\n\n// count the resource flags you intend to set before invoking docker update.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require at least one resource flag in your update wrapper.","Use `docker inspect` (not `docker update`) to read current limits.","Surface a clear usage message if no resource flags are supplied."],"tags":["cli-options","validation","container","update","resources"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}