GoogleContainerTools/skaffold · error

normalizing dockerfile path: %w

Error message

normalizing dockerfile path: %w

What it means

Wraps a failure from NormalizeDockerfilePath when resolving the absolute Dockerfile path within the artifact workspace. evalBuildArgs must read the Dockerfile to filter unused build args, so a bad path aborts build-arg evaluation.

Source

Thrown at pkg/skaffold/docker/build_args.go:70

	switch mode {
	case config.RunModes.Debug:
		defaults = debugModeArgs
	default:
		defaults = nonDebugModeArgs
	}
	result := map[string]*string{
		"SKAFFOLD_RUN_MODE": util.Ptr(string(mode)),
	}
	for k, v := range defaults {
		result[k] = &v
	}

	for k, v := range extra {
		result[k] = v
	}
	absDockerfilePath, err := NormalizeDockerfilePath(workspace, dockerfilePath)
	if err != nil {
		return nil, fmt.Errorf("normalizing dockerfile path: %w", err)
	}
	f, err := os.Open(absDockerfilePath)
	if err != nil {
		return nil, fmt.Errorf("reading dockerfile: %w", err)
	}
	defer f.Close()
	result, err = filterUnusedBuildArgs(f, result)
	if err != nil {
		return nil, fmt.Errorf("removing unused default args: %w", err)
	}
	for k, v := range args {
		result[k] = v
	}
	result, err = util.EvaluateEnvTemplateMapWithEnv(result, env)
	if err != nil {
		return nil, fmt.Errorf("unable to expand build args: %w", err)
	}
	return result, nil

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify the dockerfile path exists relative to the artifact context/workspace
  2. Correct skaffold.yaml so docker.dockerfile matches the actual file location
  3. Ensure the workspace was cloned/checked out before build
  4. If using an absolute path, ensure it resolves and is a regular file

Example fix

// before
docker:
  dockerfile: dockerfiles/Dockerfile.prod  # missing
// after
docker:
  dockerfile: Dockerfile  # exists in context dir
Defensive patterns

Strategy: validation

Validate before calling

func dockerfileInWorkspace(ws, df string) error {
  abs, err := filepath.Abs(filepath.Join(ws, df))
  if err != nil { return err }
  if !strings.HasPrefix(abs, filepath.Clean(ws)+string(os.PathSeparator)) {
    return fmt.Errorf("dockerfile %s outside workspace %s", df, ws)
  }
  fi, err := os.Stat(abs)
  if err != nil { return err }
  if fi.IsDir() { return fmt.Errorf("%s is a directory", abs) }
  return nil
}

Try / catch

args, err := evalBuildArgs(workspace, df, args, env)
if err != nil && strings.Contains(err.Error(), "normalizing dockerfile path") {
  return fmt.Errorf("check skaffold.yaml docker.dockerfile path: %w", err)
}

Prevention

When it happens

Trigger: evalBuildArgs runs with a dockerfilePath that, after joining with workspace, doesn't exist, escapes the workspace, or is a directory instead of a file.

Common situations: dockerfile path typo in skaffold.yaml; Dockerfile in a different context directory than configured; absolute dockerfilePath not under workspace; missing repository checkout (file absent).

Related errors


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