GoogleContainerTools/skaffold · error

creating directory %q: %w

Error message

creating directory %q: %w

What it means

Fires during `skaffold credits export` when os.Mkdir fails to create a directory under the output path (specified by --export-path) for the credits/licenses files, and the error is not an 'already exists' condition. Commonly caused by a missing parent directory, permission denial, or a read-only filesystem.

Source

Thrown at cmd/skaffold/app/cmd/credits/export.go:42

	"log"
	"os"
	"path"
	"path/filepath"
	"strings"

	"github.com/GoogleContainerTools/skaffold/v2/fs"
)

var Path string

// Export writes all the licenses and credit files to the `Path` folder.
func Export(ctx context.Context, out io.Writer) error {
	if err := iofs.WalkDir(fs.AssetsFS, "assets/credits_generated", func(filePath string, dirEntry iofs.DirEntry, err error) error {
		newPath := path.Join(Path, strings.Replace(filePath, "assets/credits_generated", "", 1))
		if dirEntry.IsDir() {
			err := os.Mkdir(newPath, 0755)
			if err != nil && !os.IsExist(err) {
				return fmt.Errorf("creating directory %q: %w", newPath, err)
			}
		} else {
			file, err := fs.AssetsFS.Open(filePath)
			if err != nil {
				return fmt.Errorf("opening %q in embedded filesystem: %w", filePath, err)
			}

			buf, err := io.ReadAll(file)
			if err != nil {
				return fmt.Errorf("reading %q in embedded filesystem: %w", filePath, err)
			}

			if err := os.WriteFile(newPath, buf, 0664); err != nil {
				return fmt.Errorf("writing %q to %q: %w", filePath, newPath, err)
			}
		}
		return nil
	}); err != nil {

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify the --export-path value is correct and writable (check permissions with ls -ld)
  2. Create the target directory and its parents manually (mkdir -p) before re-running
  3. If exporting to a protected location, rerun with appropriate write access or choose another directory
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/skaffold/app/cmd/credits/export.go:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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