GoogleContainerTools/skaffold · error

getting multi-level repo support: %w

Error message

getting multi-level repo support: %w

What it means

ApplyDefaultRepo returns this when config.GetMultiLevelRepo fails while reading the multi-level repo support setting from the global skaffold config. This boolean controls whether default repo substitution applies to multi-level repository paths; the error indicates the global config file could not be read or parsed. The wrapped error from GetMultiLevelRepo identifies the underlying cause.

Source

Thrown at pkg/skaffold/deploy/util/util.go:64

	"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/tag"
	"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/stringset"
	timeutil "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/time"
)

var (
	confirmHydrationDirOverride = prompt.ConfirmHydrationDirOverride
)

// ApplyDefaultRepo applies the default repo to a given image tag.
func ApplyDefaultRepo(globalConfig string, defaultRepo *string, tag string) (string, error) {
	repo, err := config.GetDefaultRepo(globalConfig, defaultRepo)
	if err != nil {
		return "", fmt.Errorf("getting default repo: %w", err)
	}

	multiLevel, err := config.GetMultiLevelRepo(globalConfig)
	if err != nil {
		return "", fmt.Errorf("getting multi-level repo support: %w", err)
	}

	newTag, err := docker.SubstituteDefaultRepoIntoImage(repo, multiLevel, tag)
	if err != nil {
		return "", fmt.Errorf("applying default repo to %q: %w", tag, err)
	}

	return newTag, nil
}

// Update which images are logged, if the image is present in the provided deployer's artifacts.
func AddTagsToPodSelector(runnerBuilds []graph.Artifact, deployerArtifacts []graph.Artifact, podSelector *kubernetes.ImageList) {
	// This implementation is mostly picked from v1 for fixing log duplication issue when multiple deployers are used.
	// According to the original author "Each Deployer will be directly responsible for adding its deployed artifacts to the PodSelector
	// by cross-referencing them against the list of images parsed out of the set of manifests they each deploy". Each deploy should only
	// add its own deployed artifacts to the PodSelector to avoid duplicate logging when multi-deployers are used.
	// This implementation only streams logs for the intersection of runnerBuilds and deployerArtifacts images, not all images from a deployer
	// probably because at that time the team didn't want to stream logs from images not built by Skaffold, e.g. images from docker hub, but this

View on GitHub (pinned to a1189de023)

Solutions

  1. Check the global skaffold config file (~/.skaffold/config by default) parses correctly; remove or repair corrupt entries.
  2. Check file permissions on the global config file so the current user can read it.
  3. Back up and delete ~/.skaffold/config, then re-run `skaffold config set` commands to regenerate it.
  4. Ensure the skaffold version matches the config schema; upgrade skaffold if the config was written by a newer version.

Example fix

// before
$ cat ~/.skaffold/config # truncated/invalid YAML
// after
$ mv ~/.skaffold/config ~/.skaffold/config.bak
$ skaffold config set --global default-repo gcr.io/my-project
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check that multi-level repo setting is readable
multiLevel, err := config.GetMultiLevelRepo(globalConfig)
if err != nil {
	return fmt.Errorf("global skaffold config unreadable (%s): %w", globalConfig, err)
}
_ = multiLevel

Try / catch

newTag, err := util.ApplyDefaultRepo(globalConfig, defaultRepo, tag)
if err != nil && strings.Contains(err.Error(), "getting multi-level repo support") {
	return fmt.Errorf("global config %s is corrupt or unreadable; regenerate it: %w", globalConfig, err)
}

Prevention

When it happens

Trigger: Calling ApplyDefaultRepo (via ImageTags) where config.GetMultiLevelRepo(globalConfig) errors — typically when the globalConfig path points to an unreadable or malformed skaffold config file, immediately after the default-repo lookup succeeded.

Common situations: A partially written or corrupted ~/.skaffold/config; permission errors on the global config file; a config file written by a newer skaffold version with unexpected schema fields; globalConfig pointing at the wrong path.

Related errors


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