GoogleContainerTools/skaffold · error

filename not specified

Error message

filename not specified

What it means

ReadConfiguration loads a skaffold.yaml from a path, stdin ("-"), or a remote URL. An empty filePath gives it nothing to read, so it immediately returns "filename not specified" before any I/O. It guards the API against callers that skip the -f/--filename resolution step.

Source

Thrown at pkg/skaffold/util/config.go:41

	"os"
	"path/filepath"

	"github.com/spf13/afero"

	"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
)

// Fs is the underlying filesystem to use for reading skaffold project files & configuration.  OS FS by default
var Fs = afero.NewOsFs()

var stdin []byte

// ReadConfiguration reads a `skaffold.yaml` configuration and
// returns its content.
func ReadConfiguration(filePath string) ([]byte, error) {
	switch {
	case filePath == "":
		return nil, errors.New("filename not specified")
	case filePath == "-":
		if len(stdin) == 0 {
			var err error
			stdin, err = io.ReadAll(os.Stdin)
			if err != nil {
				return []byte{}, err
			}
		}
		return stdin, nil
	case IsURL(filePath):
		return Download(filePath)
	default:
		if !filepath.IsAbs(filePath) {
			dir, err := os.Getwd()
			if err != nil {
				return []byte{}, err
			}
			filePath = filepath.Join(dir, filePath)

View on GitHub (pinned to a1189de023)

Solutions

  1. Pass a concrete path, e.g. util.ReadConfiguration("skaffold.yaml").
  2. Apply the default filename at the call site when the flag/env is empty (opts.ConfigurationFile defaults to skaffold.yaml in the CLI).
  3. Use "-" to read from stdin or an http(s) URL for remote configs.
  4. Check that the variable feeding filePath is actually populated (log it before the call).

Example fix

// before
cfg, err := util.ReadConfiguration(configPath) // configPath == ""
// after
if configPath == "" {
    configPath = "skaffold.yaml"
}
cfg, err := util.ReadConfiguration(configPath)
Defensive patterns

Strategy: validation

Validate before calling

if (!filePath) throw new Error('skaffold config file path is required');

Try / catch

let cfg;
try {
  cfg = await util.ReadConfiguration(filePath);
} catch (e) {
  if (e.message === 'filename not specified') {
    cfg = await util.ReadConfiguration('skaffold.yaml');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling util.ReadConfiguration("") programmatically (e.g. from buildMapOfSchemaObjPointerToYAMLInfos or tests); skaffold invoked without -f and the caller failed to apply the default "skaffold.yaml" before this low-level call.

Common situations: Custom tooling or tests invoking the config-reading API directly with an unset variable; refactors that dropped the default-filename fallback; passing an os.Getenv result that is empty.

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


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/34738b428c67780d. Report an issue: GitHub.