GoogleContainerTools/skaffold · error
failed to initialize sync state for %q: %w
Error message
failed to initialize sync state for %q: %w
What it means
Skaffold failed to initialize the incremental sync state for a Jib artifact. When an artifact has `sync.auto` set and is a Jib build, `jib.InitSync` inspects the Jib build to compute which files can be synced; a failure there is wrapped with the artifact's image name. Without init sync, the dev loop cannot sync this artifact's changes.
Source
Thrown at pkg/skaffold/sync/sync.go:389
}
if numSynced == 0 {
log.Entry(ctx).Warnf("sync failed for artifact %q", image)
return errors.New("didn't sync any files")
}
return nil
}
func Init(ctx context.Context, artifacts []*latest.Artifact) error {
for _, a := range artifacts {
if a.Sync == nil {
continue
}
if a.Sync.Auto != nil && a.JibArtifact != nil {
err := jib.InitSync(ctx, a.Workspace, a.JibArtifact)
if err != nil {
return fmt.Errorf("failed to initialize sync state for %q: %w", a.ImageName, err)
}
}
}
return nil
}
View on GitHub (pinned to a1189de023)
Solutions
- Build the project once before dev (`./mvnw package` / `./gradlew assemble`) so jib artifacts exist
- Validate jib configuration in pom.xml/build.gradle and jib plugin version
- Read the wrapped cause for the specific jib failure and fix it in the build file
- If auto-sync of a Jib artifact is not required, remove `sync.auto` for that artifact
Example fix
// before: skaffold.yaml
sync:
auto: true
// after: ensure jib built first, or use manual sync rules
sync:
manual:
- src: 'src/main/**'
dest: /app Defensive patterns
Strategy: validation
Validate before calling
// pre-validate jib artifact state before Init
if a.Sync.Auto != nil && a.JibArtifact != nil {
if _, err := os.Stat(filepath.Join(a.Workspace, "target")); os.IsNotExist(err) {
return fmt.Errorf("build jib artifact for %q before dev", a.ImageName)
}
} Try / catch
if err := jib.InitSync(ctx, a.Workspace, a.JibArtifact); err != nil {
return fmt.Errorf("jib init for %s failed, run mvn package / gradlew assemble first: %w", a.ImageName, err)
} Prevention
- Run the package build once before skaffold dev so jib outputs exist
- Keep jib plugin versions current in pom.xml/build.gradle
- Validate skaffold.yaml sync config with `skaffold config`/schema check
- Disable sync.auto for artifacts that don't need jib auto-sync
When it happens
Trigger: `Init` iterates artifacts where `a.Sync.Auto != nil && a.JibArtifact != nil` and calls `jib.InitSync(ctx, a.Workspace, a.JibArtifact)`; the Jib JAR inspection fails (e.g. malformed/unbuilt jar, jib config missing, unsupported jib version).
Common situations: Jib jar not built yet before `skaffold dev` starts; pom.xml/build.gradle jib configuration missing or malformed; multi-module Gradle workspace misconfigured; corrupted build output in the workspace.
Related errors
- didn't sync any files
- creating runner: %w
- constructing inferred sync map: %w
- walking workspace: %w
- stating file %q: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/30d57fa152e66bf3.
Report an issue: GitHub.