{"record":{"id":"2cbf259b78d5ab54","repo":"GoogleContainerTools/skaffold","slug":"inspect-namespaces-list-requires-exactly-one-man","errorCode":null,"errorMessage":"`inspect namespaces list` requires exactly one manifest file path argument","messagePattern":"`inspect namespaces list` requires exactly one manifest file path argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/inspect_namespaces.go","lineNumber":47,"sourceCode":"\tolog \"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log\"\n)\n\nfunc cmdNamespaces() *cobra.Command {\n\treturn NewCmd(\"namespaces\").\n\t\tWithDescription(\"View skaffold namespace information for resources it manages\").\n\t\tWithCommands(cmdNamespacesList())\n}\n\nfunc cmdNamespacesList() *cobra.Command {\n\treturn NewCmd(\"list\").\n\t\tWithExample(\"Get list of namespaces\", \"inspect namespaces list --format json\").\n\t\tWithExample(\"Get list of namespaces targeting a specific configuration\", \"inspect namespaces list --profile local --format json\").\n\t\tWithDescription(\"Print the list of namespaces that would be run for a given configuration (default skaffold configuration, specific module, specific profile, etc).\").\n\t\tWithFlagAdder(cmdNamespacesListFlags).\n\t\tWithArgs(func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) != 1 {\n\t\t\t\tolog.Entry(context.TODO()).Errorf(\"`inspect namespaces list` requires exactly one manifest file path argument\")\n\t\t\t\treturn errors.New(\"`inspect namespaces list` requires exactly one manifest file path argument\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}, listNamespaces)\n}\n\n// NOTE:\n//   - currently kubecontext namespaces are not handled as they were not expected for the\n//     initial use cases involving this command\n//   - also this code currently does not account for the possibility of the -n flag passed\n//     additionally to a skaffold command (eg: skaffold apply -n foo)\nfunc listNamespaces(ctx context.Context, out io.Writer, args []string) error {\n\treturn namespaces.PrintNamespacesList(ctx, out, args[0], inspect.Options{\n\t\tFilename:          inspectFlags.filename,\n\t\tRemoteCacheDir:    inspectFlags.remoteCacheDir,\n\t\tOutFormat:         inspectFlags.outFormat,\n\t\tModules:           inspectFlags.modules,\n\t\tProfiles:          inspectFlags.profiles,\n\t\tPropagateProfiles: inspectFlags.propagateProfiles,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/inspect_namespaces.go#L29-L65","documentation":"`skaffold inspect namespaces list` prints the namespaces that would be used for a given configuration and requires exactly one positional argument: the manifest file path. The Args validator enforces len(args) == 1.","triggerScenarios":"Running `skaffold inspect namespaces list` with zero positional args (e.g. relying only on --profile/--format flags), or with multiple positional args.","commonSituations":"Assuming the command reads skaffold.yaml from the current directory by default (it requires the path argument); extra stray tokens on the command line.","solutions":["Pass the manifest path: `skaffold inspect namespaces list skaffold.yaml`","Combine with flags as needed: `skaffold inspect namespaces list skaffold.yaml --profile local --format json`","Ensure no extra positional tokens follow the file path"],"exampleFix":"// before\nskaffold inspect namespaces list --profile local --format json\n// after\nskaffold inspect namespaces list skaffold.yaml --profile local --format json","handlingStrategy":"validation","validationCode":"[ $# -eq 1 ] || { echo \"usage: skaffold inspect namespaces list <manifest>\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the manifest file path as the positional argument","Remember the command does not default to ./skaffold.yaml"],"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"}