GoogleContainerTools/skaffold · error

CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR

CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR

Error message

cache directory %q for repository %q at ref %q does not exist, and repository sync is explicitly disabled via flag `--sync-remote-cache`

What it means

The git dependency handler mirrors the GCS behavior: SyncDisabledErr is returned by syncRepo when the user disabled repository sync (--sync-remote-cache=false) but the cloned repository cache directory for the given repo and ref does not exist. The error carries code CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR and suggests enabling remote sync.

Source

Thrown at pkg/skaffold/git/errors.go:30

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package git

import (
	"errors"
	"fmt"

	sErrors "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/errors"
	"github.com/GoogleContainerTools/skaffold/v2/proto/v1"
)

// SyncDisabledErr returns error when git repository sync is turned off by the user but the repository clone doesn't exist inside the cache directory.
func SyncDisabledErr(g Config, repoCacheDir string) error {
	msg := fmt.Sprintf("cache directory %q for repository %q at ref %q does not exist, and repository sync is explicitly disabled via flag `--sync-remote-cache`", repoCacheDir, g.Repo, g.Ref)
	return sErrors.NewError(errors.New(msg),
		&proto.ActionableErr{
			Message: msg,
			ErrCode: proto.StatusCode_CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR,
			Suggestions: []*proto.Suggestion{
				{
					SuggestionCode: proto.SuggestionCode_CONFIG_ENABLE_REMOTE_REPO_SYNC,
					Action:         fmt.Sprintf("Either clone the repository manually inside %q, or set flag `--sync-remote-cache` to `always` or `missing`", repoCacheDir),
				},
			},
		})
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Rerun without --sync-remote-cache=false so Skaffold can clone the repository
  2. Restore the cache directory from CI cache artifacts before running
  3. Pin the ref that is already present in the cache, or update the dependency ref to one that exists locally
  4. Check the printed repoCacheDir path and create the clone there manually (git clone + git checkout <ref>)

Example fix

// before
skaffold run --sync-remote-cache=false
// after
skaffold run  # first run clones repos into cache
# subsequent runs may use --sync-remote-cache=false with a restored cache
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := os.Stat(repoCacheDir); os.IsNotExist(err) {
    // repo not cloned: enable sync or clone at the pinned ref first
    exec.Command("git", "clone", repo.URL, repoCacheDir).Run()
    exec.Command("git", "-C", repoCacheDir, "checkout", repo.Ref).Run()
}

Try / catch

if err := runSkaffold(); err != nil && strings.Contains(err.Error(), "repository sync is explicitly disabled") {
    log.Println("repo cache missing; retrying with remote sync enabled")
    err = runSkaffold("--sync-remote-cache=true")
}

Prevention

When it happens

Trigger: Using a git dependency in skaffold.yaml while running with --sync-remote-cache=false, where no prior run has cloned the repo at the requested ref into the cache directory.

Common situations: Fresh CI machine with sync disabled and no cache restored; cached clone deleted by cleanup; ref changed (new commit) so the cached dir for that ref is missing; typo in cache path env.

Related errors


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