{"record":{"id":"e8de462990577420","repo":"GoogleContainerTools/skaffold","slug":"constructing-inferred-sync-map-w","errorCode":null,"errorMessage":"constructing inferred sync map: %w","messagePattern":"constructing inferred sync map: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/diagnose/diagnose.go","lineNumber":79,"sourceCode":"\n\t\t\ttimeDeps1, deps, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}\n\t\t\ttimeDeps2, _, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}\n\n\t\t\tfmt.Fprintln(out, \" - Dependencies:\", len(deps), \"files\")\n\t\t\tfmt.Fprintf(out, \" - Time to list dependencies: %v (2nd time: %v)\\n\", timeDeps1, timeDeps2)\n\n\t\t\t// Only check sync map if inferred sync is configured on artifact\n\t\t\tif artifact.Sync != nil && len(artifact.Sync.Infer) > 0 {\n\t\t\t\ttimeSyncMap1, err := timeToConstructSyncMap(ctx, artifact, cfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif _, isNotSupported := err.(build.ErrSyncMapNotSupported); !isNotSupported {\n\t\t\t\t\t\treturn fmt.Errorf(\"constructing inferred sync map: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttimeSyncMap2, err := timeToConstructSyncMap(ctx, artifact, cfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif _, isNotSupported := err.(build.ErrSyncMapNotSupported); !isNotSupported {\n\t\t\t\t\t\treturn fmt.Errorf(\"constructing inferred sync map: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(out, \" - Time to construct sync map: %v (2nd time: %v)\\n\", timeSyncMap1, timeSyncMap2)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttimeMTimes1, err := timeToComputeMTimes(deps)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"computing modTimes: %w\", err)\n\t\t\t}\n\t\t\ttimeMTimes2, err := timeToComputeMTimes(deps)\n\t\t\tif err != nil {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/diagnose/diagnose.go#L61-L97","documentation":"For artifacts with inferred file sync (sync.infer patterns), CheckArtifacts times constructing the sync map via sync.SyncMap. If it fails with an error other than build.ErrSyncMapNotSupported, this wrapped error is returned.","triggerScenarios":"Running `skaffold diagnose` on an artifact with `sync.infer` patterns where sync.SyncMap fails — e.g. a builder that doesn't support inferred sync returning an unexpected error, or invalid infer patterns.","commonSituations":"Using sync.infer with a builder lacking sync map support that returns a non-ErrSyncMapNotSupported error; malformed glob patterns in sync.infer; dockerfile changes not reflected in sync configuration.","solutions":["Check the wrapped error for the specific sync map construction failure","Validate sync.infer patterns are well-formed globs relative to the workspace","If the builder does not support inferred sync, switch to manual sync (manual section) or remove sync.infer","Update skaffold to the latest version, older builders may report unsupported sync incorrectly"],"exampleFix":"// before: builder without infer support\nbuild:\n  artifacts:\n    - image: app\n      custom:\n        buildCommand: ./build.sh\n      sync:\n        infer: ['**/*.js']\n// after: use manual sync\n      sync:\n        manual:\n          - src: '**/*.js'\n            dest: .","handlingStrategy":"type-guard","validationCode":"if artifact.Sync != nil && len(artifact.Sync.Infer) > 0 {\n\tfor _, p := range artifact.Sync.Infer {\n\t\tif _, err := filepath.Match(p, \"\"); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid infer pattern %q: %w\", p, err)\n\t\t}\n\t}\n}","typeGuard":"var errSyncNotSupported build.ErrSyncMapNotSupported\nfunc isSyncNotSupported(err error) bool { return errors.As(err, &errSyncNotSupported) }","tryCatchPattern":"err := CheckArtifacts(ctx, cfg, tags, out)\nvar ns build.ErrSyncMapNotSupported\nif err != nil && strings.Contains(err.Error(), \"constructing inferred sync map\") && !errors.As(err, &ns) {\n\tlog.Warnf(\"sync map construction failed: %v\", err)\n}","preventionTips":["Only use sync.infer with builders that support inferred sync","Keep infer patterns as valid relative globs","Fall back to manual sync config when the builder is unsupported"],"tags":["skaffold","file-sync","diagnose"],"backgroundTag":"sync-map-construction-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"}