GoogleContainerTools/skaffold · error
`inspect namespaces list` requires exactly one manifest file
Error message
`inspect namespaces list` requires exactly one manifest file path argument
What it means
`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.
Source
Thrown at cmd/skaffold/app/cmd/inspect_namespaces.go:47
olog "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
)
func cmdNamespaces() *cobra.Command {
return NewCmd("namespaces").
WithDescription("View skaffold namespace information for resources it manages").
WithCommands(cmdNamespacesList())
}
func cmdNamespacesList() *cobra.Command {
return NewCmd("list").
WithExample("Get list of namespaces", "inspect namespaces list --format json").
WithExample("Get list of namespaces targeting a specific configuration", "inspect namespaces list --profile local --format json").
WithDescription("Print the list of namespaces that would be run for a given configuration (default skaffold configuration, specific module, specific profile, etc).").
WithFlagAdder(cmdNamespacesListFlags).
WithArgs(func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
olog.Entry(context.TODO()).Errorf("`inspect namespaces list` requires exactly one manifest file path argument")
return errors.New("`inspect namespaces list` requires exactly one manifest file path argument")
}
return nil
}, listNamespaces)
}
// NOTE:
// - currently kubecontext namespaces are not handled as they were not expected for the
// initial use cases involving this command
// - also this code currently does not account for the possibility of the -n flag passed
// additionally to a skaffold command (eg: skaffold apply -n foo)
func listNamespaces(ctx context.Context, out io.Writer, args []string) error {
return namespaces.PrintNamespacesList(ctx, out, args[0], inspect.Options{
Filename: inspectFlags.filename,
RemoteCacheDir: inspectFlags.remoteCacheDir,
OutFormat: inspectFlags.outFormat,
Modules: inspectFlags.modules,
Profiles: inspectFlags.profiles,
PropagateProfiles: inspectFlags.propagateProfiles,View on GitHub (pinned to a1189de023)
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
Example fix
// before skaffold inspect namespaces list --profile local --format json // after skaffold inspect namespaces list skaffold.yaml --profile local --format json
Defensive patterns
Strategy: validation
Validate before calling
[ $# -eq 1 ] || { echo "usage: skaffold inspect namespaces list <manifest>"; exit 1; } Prevention
- Always include the manifest file path as the positional argument
- Remember the command does not default to ./skaffold.yaml
When it happens
Trigger: Running `skaffold inspect namespaces list` with zero positional args (e.g. relying only on --profile/--format flags), or with multiple positional args.
Common situations: Assuming the command reads skaffold.yaml from the current directory by default (it requires the path argument); extra stray tokens on the command line.
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
- `config-dependencies add` requires exactly one file path arg
- `jobManifestPaths modify` 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/2cbf259b78d5ab54.
Report an issue: GitHub.