{"record":{"id":"f9c204c847fd200a","repo":"GoogleContainerTools/skaffold","slug":"getting-default-repo-w","errorCode":null,"errorMessage":"getting default repo: %w","messagePattern":"getting default repo: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/util/util.go","lineNumber":59,"sourceCode":"\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/kubernetes/manifest\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/runner/runcontext\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/tag\"\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/stringset\"\n\ttimeutil \"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/time\"\n)\n\nvar (\n\tconfirmHydrationDirOverride = prompt.ConfirmHydrationDirOverride\n)\n\n// ApplyDefaultRepo applies the default repo to a given image tag.\nfunc ApplyDefaultRepo(globalConfig string, defaultRepo *string, tag string) (string, error) {\n\trepo, err := config.GetDefaultRepo(globalConfig, defaultRepo)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting default repo: %w\", err)\n\t}\n\n\tmultiLevel, err := config.GetMultiLevelRepo(globalConfig)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting multi-level repo support: %w\", err)\n\t}\n\n\tnewTag, err := docker.SubstituteDefaultRepoIntoImage(repo, multiLevel, tag)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"applying default repo to %q: %w\", tag, err)\n\t}\n\n\treturn newTag, nil\n}\n\n// Update which images are logged, if the image is present in the provided deployer's artifacts.\nfunc AddTagsToPodSelector(runnerBuilds []graph.Artifact, deployerArtifacts []graph.Artifact, podSelector *kubernetes.ImageList) {\n\t// This implementation is mostly picked from v1 for fixing log duplication issue when multiple deployers are used.","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/util/util.go#L41-L77","documentation":"ApplyDefaultRepo returns this when config.GetDefaultRepo fails while resolving the default image repository to prefix image tags with. GetDefaultRepo merges the global skaffold config (~/.skaffold/config) with the defaultRepo flag/config value; it errors when the resolved default repo value is malformed or the global config cannot be read/parsed. Skaffold wraps it so users know the failure happened while resolving the default repo for a tag.","triggerScenarios":"Calling ApplyDefaultRepo (directly or via ImageTags) where config.GetDefaultRepo returns an error — usually a defaultRepo value that violates the expected format, or an unreadable/corrupt global skaffold config passed as globalConfig.","commonSituations":"Setting `default-repo` in ~/.skaffold/config to an invalid value; passing `--default-repo` with a malformed repository string; a global config file with a bad schema after a skaffold version upgrade.","solutions":["Verify the default repo value: run `skaffold config list` and check `default-repo` is a valid registry path (e.g. gcr.io/my-project).","Fix or remove the bad entry with `skaffold config set default-repo gcr.io/my-project` or `skaffold config unset default-repo`.","If --default-repo was passed, check the flag value for typos or invalid characters.","Inspect ~/.skaffold/config for corruption and repair or delete it, then reconfigure."],"exampleFix":"// before (bad value in ~/.skaffold/config)\ndefault-repo: /gcr.io/my-project/\n// after\ndefault-repo: gcr.io/my-project","handlingStrategy":"try-catch","validationCode":"// Validate the default repo resolves before tag rewriting\nrepo, err := config.GetDefaultRepo(globalConfig, defaultRepo)\nif err != nil {\n\treturn fmt.Errorf(\"default-repo misconfigured: %w\", err)\n}\nif repo != \"\" && strings.HasPrefix(repo, \"/\") {\n\treturn fmt.Errorf(\"invalid default repo %q\", repo)\n}","typeGuard":null,"tryCatchPattern":"newTag, err := util.ApplyDefaultRepo(globalConfig, defaultRepo, tag)\nif err != nil && strings.Contains(err.Error(), \"getting default repo\") {\n\treturn fmt.Errorf(\"fix `skaffold config set default-repo` or --default-repo flag: %w\", err)\n}","preventionTips":["Validate the --default-repo flag format before invoking.","Run `skaffold config list` after any skaffold upgrade to catch schema drift.","Keep ~/.skaffold/config under version control or backup.","Use fully-qualified registry hosts (gcr.io/project, not bare project names)."],"tags":["configuration","docker-registry","default-repo"],"backgroundTag":"invalid-registry-name","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}