{"record":{"id":"30d57fa152e66bf3","repo":"GoogleContainerTools/skaffold","slug":"failed-to-initialize-sync-state-for-q-w","errorCode":null,"errorMessage":"failed to initialize sync state for %q: %w","messagePattern":"failed to initialize sync state for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/sync/sync.go","lineNumber":389,"sourceCode":"\t}\n\n\tif numSynced == 0 {\n\t\tlog.Entry(ctx).Warnf(\"sync failed for artifact %q\", image)\n\t\treturn errors.New(\"didn't sync any files\")\n\t}\n\treturn nil\n}\n\nfunc Init(ctx context.Context, artifacts []*latest.Artifact) error {\n\tfor _, a := range artifacts {\n\t\tif a.Sync == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif a.Sync.Auto != nil && a.JibArtifact != nil {\n\t\t\terr := jib.InitSync(ctx, a.Workspace, a.JibArtifact)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to initialize sync state for %q: %w\", a.ImageName, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":371,"sourceCodeEnd":395,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/sync/sync.go#L371-L395","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","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"],"exampleFix":"// before: skaffold.yaml\nsync:\n  auto: true\n// after: ensure jib built first, or use manual sync rules\nsync:\n  manual:\n    - src: 'src/main/**'\n      dest: /app","handlingStrategy":"validation","validationCode":"// pre-validate jib artifact state before Init\nif a.Sync.Auto != nil && a.JibArtifact != nil {\n    if _, err := os.Stat(filepath.Join(a.Workspace, \"target\")); os.IsNotExist(err) {\n        return fmt.Errorf(\"build jib artifact for %q before dev\", a.ImageName)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := jib.InitSync(ctx, a.Workspace, a.JibArtifact); err != nil {\n    return fmt.Errorf(\"jib init for %s failed, run mvn package / gradlew assemble first: %w\", a.ImageName, err)\n}","preventionTips":["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"],"tags":["jib","file-sync","initialization"],"backgroundTag":"jib-sync-init-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"}