{"record":{"id":"7b9f32bace3a3a64","repo":"GoogleContainerTools/skaffold","slug":"config-dependencies-add-requires-exactly-one-fil","errorCode":null,"errorMessage":"`config-dependencies add` requires exactly one file path argument","messagePattern":"`config-dependencies add` requires exactly one file path argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/inspect_config_dependencies.go","lineNumber":47,"sourceCode":"\tolog \"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log\"\n)\n\nfunc cmdConfigDependencies() *cobra.Command {\n\treturn NewCmd(\"config-dependencies\").\n\t\tWithDescription(\"Interact with skaffold config dependency definitions.\").\n\t\tWithCommands(cmdConfigDependenciesAdd())\n}\n\nfunc cmdConfigDependenciesAdd() *cobra.Command {\n\treturn NewCmd(\"add\").\n\t\tWithDescription(\"Add config dependencies\").\n\t\tWithExample(\"Add config dependency defined in `dependency.json`.\", \"inspect config-dependencies add dependency.json -f skaffold.yaml\").\n\t\tWithFlagAdder(cmdConfigDependenciesAddFlags).\n\t\tWithArgs(func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) != 1 {\n\t\t\t\terrMsg := \"`config-dependencies add` requires exactly one file path argument\"\n\t\t\t\tolog.Entry(context.TODO()).Error(errMsg)\n\t\t\t\treturn errors.New(errMsg)\n\t\t\t}\n\t\t\treturn nil\n\t\t}, addConfigDependencies)\n}\n\nfunc cmdConfigDependenciesAddFlags(f *pflag.FlagSet) {\n\tf.StringSliceVarP(&inspectFlags.modules, \"module\", \"m\", nil, \"Names of modules to filter target action by.\")\n}\n\nfunc addConfigDependencies(ctx context.Context, out io.Writer, args []string) error {\n\treturn configDependencies.AddConfigDependencies(ctx, out, inspect.Options{\n\t\tFilename:       inspectFlags.filename,\n\t\tOutFormat:      inspectFlags.outFormat,\n\t\tRemoteCacheDir: inspectFlags.remoteCacheDir,\n\t\tModules:        inspectFlags.modules,\n\t}, args[0])\n}\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/inspect_config_dependencies.go#L29-L65","documentation":"`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.","triggerScenarios":"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.","commonSituations":"Passing multiple dependency files at once expecting batch add; omitting the file path and only providing `-f skaffold.yaml`.","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"],"exampleFix":"// before\nskaffold inspect config-dependencies add dep1.json dep2.json -f skaffold.yaml\n// after\nskaffold inspect config-dependencies add dep1.json -f skaffold.yaml\nskaffold inspect config-dependencies add dep2.json -f skaffold.yaml","handlingStrategy":"validation","validationCode":"FILES=(dependency.json)\n[ ${#FILES[@]} -eq 1 ] || { echo \"exactly one file path required\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"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"}