GoogleContainerTools/skaffold · error
`config-dependencies add` requires exactly one file path arg
Error message
`config-dependencies add` requires exactly one file path argument
What it means
`skaffold inspect config-dependencies add` registers a config dependency and needs exactly one positional argument: the path to the dependency file. The Args validator rejects anything other than exactly one argument, logging the error via olog before returning it.
Source
Thrown at cmd/skaffold/app/cmd/inspect_config_dependencies.go:47
olog "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
)
func cmdConfigDependencies() *cobra.Command {
return NewCmd("config-dependencies").
WithDescription("Interact with skaffold config dependency definitions.").
WithCommands(cmdConfigDependenciesAdd())
}
func cmdConfigDependenciesAdd() *cobra.Command {
return NewCmd("add").
WithDescription("Add config dependencies").
WithExample("Add config dependency defined in `dependency.json`.", "inspect config-dependencies add dependency.json -f skaffold.yaml").
WithFlagAdder(cmdConfigDependenciesAddFlags).
WithArgs(func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
errMsg := "`config-dependencies add` requires exactly one file path argument"
olog.Entry(context.TODO()).Error(errMsg)
return errors.New(errMsg)
}
return nil
}, addConfigDependencies)
}
func cmdConfigDependenciesAddFlags(f *pflag.FlagSet) {
f.StringSliceVarP(&inspectFlags.modules, "module", "m", nil, "Names of modules to filter target action by.")
}
func addConfigDependencies(ctx context.Context, out io.Writer, args []string) error {
return configDependencies.AddConfigDependencies(ctx, out, inspect.Options{
Filename: inspectFlags.filename,
OutFormat: inspectFlags.outFormat,
RemoteCacheDir: inspectFlags.remoteCacheDir,
Modules: inspectFlags.modules,
}, args[0])
}
View on GitHub (pinned to a1189de023)
Solutions
- Provide exactly one dependency file path: `skaffold inspect config-dependencies add dependency.json -f skaffold.yaml`
- Run the command once per dependency file instead of passing multiple paths
- Check shell quoting so the path isn't split into multiple arguments
Example fix
// before skaffold inspect config-dependencies add dep1.json dep2.json -f skaffold.yaml // after skaffold inspect config-dependencies add dep1.json -f skaffold.yaml skaffold inspect config-dependencies add dep2.json -f skaffold.yaml
Defensive patterns
Strategy: validation
Validate before calling
FILES=(dependency.json)
[ ${#FILES[@]} -eq 1 ] || { echo "exactly one file path required"; exit 1; } Prevention
- Run the command once per dependency file
- Keep the skaffold config in the -f flag, not as a positional arg
- Quote file paths to avoid word splitting
When it happens
Trigger: Running `skaffold inspect config-dependencies add` with zero args or more than one file path, e.g. `add dep1.json dep2.json`. The dependency file path must be the single positional arg; the skaffold config is supplied via the -f flag.
Common situations: Passing multiple dependency files at once expecting batch add; omitting the file path and only providing `-f skaffold.yaml`.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- `apply` requires at least one manifest argument
- `exec` requires exactly one action to execute
- `jobManifestPaths modify` requires exactly one manifest file
- `inspect namespaces list` requires exactly one manifest file
- running diagnostic on artifacts: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/7b9f32bace3a3a64.
Report an issue: GitHub.