{"record":{"id":"025c38f19b05945c","repo":"GoogleContainerTools/skaffold","slug":"apply-requires-at-least-one-manifest-argument","errorCode":null,"errorMessage":"`apply` requires at least one manifest argument","messagePattern":"`apply` requires at least one manifest argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/apply.go","lineNumber":51,"sourceCode":"// NewCmdApply describes the CLI command to apply manifests to a cluster.\nfunc NewCmdApply() *cobra.Command {\n\treturn NewCmd(\"apply\").\n\t\tWithDescription(\"Apply hydrated manifests to a cluster\").\n\t\tWithExample(\"Hydrate Kubernetes pod manifest first\", \"render --output rendered-pod.yaml\").\n\t\tWithExample(\"Then create resources on your cluster from that hydrated manifest\", \"apply rendered-pod.yaml\").\n\t\tWithCommonFlags().\n\t\tWithFlags([]*Flag{\n\t\t\t{Value: &opts.InventoryNamespace, Name: \"inventory-namespace\", Hidden: true, DefValue: \"\",\n\t\t\t\tUsage: \"The namespace for the ResourceGroup resource that contains the inventory\"},\n\t\t\t{Value: &opts.InventoryID, Name: \"inventory-id\", Hidden: true, DefValue: \"\",\n\t\t\t\tUsage: \"The inventory name, default to `.kpt-pipeline`\"},\n\t\t\t{Value: &opts.InventoryName, Name: \"inventory-name\", Hidden: true, DefValue: \"\",\n\t\t\t\tUsage: \"Inventory identifier.\"},\n\t\t}).\n\t\tWithHouseKeepingMessages().\n\t\tWithArgs(func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) < 1 {\n\t\t\t\treturn errors.New(\"`apply` requires at least one manifest argument\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}, doApply)\n}\n\nfunc doApply(ctx context.Context, out io.Writer, args []string) error {\n\t// force set apply boolean to select default options in runner creation\n\topts.Apply = true\n\topts.HydratedManifests = args\n\tif err := validateManifests(args); err != nil {\n\t\treturn err\n\t}\n\treturn withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {\n\t\treturn r.Apply(ctx, out)\n\t})\n}\n\nfunc validateManifests(manifests []string) error {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/apply.go#L33-L69","documentation":"Skaffold's `apply` command requires at least one positional argument: the path to a manifest (e.g. skaffold.yaml or a k8s manifest) to apply. The Args validator on the cobra command returns this error before doApply runs when no arguments are passed. It exists to fail fast with a clear message instead of failing later inside the apply pipeline.","triggerScenarios":"Running `skaffold apply` with zero positional arguments. Any invocation where cmd args is empty, e.g. just `skaffold apply` or `skaffold apply --profile=prod` with no manifest path.","commonSituations":"Users coming from `skaffold dev` habits where no manifest argument was needed; CI scripts that lost their argument due to an unset variable (`skaffold apply $MANIFEST` with MANIFEST empty).","solutions":["Pass at least one manifest argument: `skaffold apply skaffold.yaml`","If the argument comes from a variable, guard it: `skaffold apply \"${MANIFEST:?manifest path required}\"`","Use `--filename`/`-f` flag if you intended to point at a config rather than pass a positional manifest"],"exampleFix":"// before\nskaffold apply\n// after\nskaffold apply skaffold.yaml","handlingStrategy":"validation","validationCode":"const args = process.argv.slice(2); // shell-side guard\nif [ -z \"$1\" ]; then echo \"usage: skaffold apply <manifest>\"; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit manifest path to `skaffold apply`","In scripts, use ${VAR:?msg} to fail early on unset variables","Check `skaffold apply --help` for the expected positional argument"],"tags":["cli","argument-validation","skaffold"],"backgroundTag":"missing-required-argument","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}