{"record":{"id":"329960cb820674c3","repo":"GoogleContainerTools/skaffold","slug":"caching-remote-dependency-s-w","errorCode":null,"errorMessage":"caching remote dependency %s: %w","messagePattern":"caching remote dependency (.+?): %w","errorType":"console","errorClass":"ConfigParsingError","httpStatus":null,"severity":"error","filePath":"pkg/skaffold/parser/config.go","lineNumber":312,"sourceCode":"\n\tif d.GoogleCloudBuildRepoV2 != nil {\n\t\trepInf, err := gcbreposv2.GetRepoInfo(ctx, d.GoogleCloudBuildRepoV2.ProjectID, d.GoogleCloudBuildRepoV2.Region, d.GoogleCloudBuildRepoV2.Connection, d.GoogleCloudBuildRepoV2.Repo)\n\t\tif err != nil {\n\t\t\treturn nil, sErrors.ConfigParsingError(fmt.Errorf(\"getting GCB repo info for %s: %w\", d.GoogleCloudBuildRepoV2.Repo, err))\n\t\t}\n\t\tconfigFilePath = d.GoogleCloudBuildRepoV2.Path\n\t\trepoInfo = &git.Config{\n\t\t\tRepo:         repInf.URI,\n\t\t\tRepoCloneURI: repInf.CloneURI,\n\t\t\tRef:          d.GoogleCloudBuildRepoV2.Ref,\n\t\t\tSync:         d.GoogleCloudBuildRepoV2.Sync,\n\t\t}\n\t}\n\n\tif repoInfo != nil {\n\t\tcachePath, err := cacheRepo(ctx, *repoInfo, configFilePath, opts, r)\n\t\tif err != nil {\n\t\t\treturn nil, sErrors.ConfigParsingError(fmt.Errorf(\"caching remote dependency %s: %w\", repoInfo.Repo, err))\n\t\t}\n\t\tpath = cachePath\n\t\tisRemoteCfg = true\n\t}\n\n\tif d.GoogleCloudStorage != nil {\n\t\tcachePath, err := cacheGCSObject(ctx, *d.GoogleCloudStorage, opts, r)\n\t\tif err != nil {\n\t\t\treturn nil, sErrors.ConfigParsingError(fmt.Errorf(\"caching remote dependency %s: %w\", d.GoogleCloudStorage.Path, err))\n\t\t}\n\t\tpath = cachePath\n\t\tisRemoteCfg = true\n\t}\n\n\tif path == \"\" {\n\t\t// empty path means configs in the same file\n\t\tpath = cfgOpts.file\n\t}","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/parser/config.go#L294-L330","documentation":"After resolving repo info for a remote config dependency (git or GCB), skaffold clones/caches the repository locally via cacheRepo so its configs can be parsed. If caching fails (clone error, auth, bad ref), the error is wrapped with the repo name and returned as a ConfigParsingError. The underlying git/network error is the real cause.","triggerScenarios":"cacheRepo fails: git clone cannot reach the remote (network, auth, missing SSH keys/token), the configured Ref does not exist, the repo URI/clone URI is wrong, or the local cache directory is unwritable/corrupt.","commonSituations":"Private git repos without deploy keys/credentials configured; typo'd ref/branch/tag in the dependency; VPN/offline while cloning; stale cache directory with wrong permissions; repo moved to a new host so the URI no longer resolves.","solutions":["Read the wrapped cause: fix git auth (add SSH keys or credential helper) or network first, then re-run","Verify the repo URI and ref (git ls-remote <repo> <ref>) exist and are reachable","Clear a corrupt cache directory and let skaffold re-clone","If the dependency is wrong in skaffold.yaml, correct the git.repo/ref or switch to a local path dependency for testing"],"exampleFix":"// before\ndependencies:\n  - git:\n      repo: git@github.com:org/private-configs.git\n      ref: no-such-branch\n// after\ndependencies:\n  - git:\n      repo: https://github.com/org/private-configs.git\n      ref: main\n      sync: false","handlingStrategy":"try-catch","validationCode":"// verify the remote dep is clonable before parsing\nref := dep.Git.Ref\nif ref == \"\" { ref = \"HEAD\" }\nif err := exec.Command(\"git\", \"ls-remote\", dep.Git.Repo, ref).Run(); err != nil {\n    return fmt.Errorf(\"remote dep %s unreachable or bad ref: %w\", dep.Git.Repo, err)\n}","typeGuard":null,"tryCatchPattern":"cfgs, err := skaffoldConfig.Parse(...)\nif err != nil {\n    var pe *sErrors.ConfigParsingError\n    if errors.As(err, &pe) && strings.Contains(err.Error(), \"caching remote dependency\") {\n        exec.Command(\"git\", \"credential\", \"fill\").Run() // trigger credential helper\n        os.RemoveAll(cacheDir) // clear stale cache, then retry\n        cfgs, err = skaffoldConfig.Parse(...)\n    }\n    if err != nil { return err }\n}","preventionTips":["Set up git credentials (SSH keys or credential helper) for private dependency repos","Verify refs with 'git ls-remote <repo> <ref>' before committing them to skaffold.yaml","Clear the skaffold cache directory if clones repeatedly fail with corrupt-repo errors","For local iteration, use a local path dependency instead of a remote git dep"],"tags":["git","config","clone","network"],"backgroundTag":"git-clone-failed","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"}