{"record":{"id":"fe401de9cdd5836e","repo":"GoogleContainerTools/skaffold","slug":"the-following-versions-are-incompatible-with-targe","errorCode":null,"errorMessage":"the following versions are incompatible with target version %v. upgrade aborted","messagePattern":"the following versions are incompatible with target version (.+?)\\. upgrade aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/versions.go","lineNumber":381,"sourceCode":"// IsCompatibleWith checks if the cfgs versions can be upgraded to toVersion.\nfunc IsCompatibleWith(cfgs []util.VersionedConfig, toVersion string) (bool, error) {\n\tvar pattern *regexp.Regexp\n\tif matched := V1Pattern.MatchString(toVersion); matched {\n\t\tpattern = V1Pattern\n\t} else if matched := V2Pattern.MatchString(toVersion); matched {\n\t\tpattern = V2Pattern\n\t} else {\n\t\treturn false, fmt.Errorf(\"target version %v is invalid\", toVersion)\n\t}\n\tvar badVersions []string\n\tfor _, cfg := range cfgs {\n\t\tcurVersion := cfg.GetVersion()\n\t\tif matched := pattern.MatchString(curVersion); !matched {\n\t\t\tbadVersions = append(badVersions, curVersion)\n\t\t}\n\t}\n\tif len(badVersions) > 0 {\n\t\treturn false, fmt.Errorf(\n\t\t\t\"the following versions are incompatible with target version %v. upgrade aborted\",\n\t\t\tbadVersions)\n\t}\n\treturn true, nil\n}\n\n// UpgradeTo upgrades the given configs to toVersion.\nfunc UpgradeTo(configs []util.VersionedConfig, toVersion string) ([]util.VersionedConfig, error) {\n\tupgradeNeeded := false\n\tfor _, cfg := range configs {\n\t\t// Check that the config's version is not newer than the target version\n\t\tcurrentVersion, err := apiversion.Parse(cfg.GetVersion())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetVersion, err := apiversion.Parse(toVersion)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/versions.go#L363-L399","documentation":"IsCompatibleWith in pkg/skaffold/schema/versions.go checks whether every skaffold.yaml config's apiVersion matches the version track (V1 or V2) of the requested target version. If any config's version falls on a different track, the automatic upgrade is refused because skaffold cannot transform configs across major version tracks. It returns (false, err) listing the offending versions.","triggerScenarios":"Calling IsCompatibleWith(configs, toVersion) where toVersion matches, say, V2Pattern but at least one config's GetVersion() string (e.g. 'skaffold/v1' or a malformed version) does not match the same pattern. Also implicitly hit when a v1 config is present while upgrading toward a v2 target (or vice versa).","commonSituations":"A developer runs 'skaffold fix --v1' or config parsing/upgrade on a workspace whose skaffold.yaml uses an old major version line (skaffold/v1beta*) that cannot be auto-upgraded to the requested major track, or mixes multiple files/configs with different major versions in one invocation.","solutions":["Bump the apiVersion line in skaffold.yaml to the target major track manually (e.g. change 'skaffold/v1betaN' to the latest v1 line, then re-run).","Run `skaffold fix` on each listed config to transform it onto the target version track before calling the API.","If the cross-track hop is the problem, upgrade in two steps: first to the latest version of the current track, then to the target track.","Ensure all configs in the slice target the same major version track before invoking IsCompatibleWith."],"exampleFix":"// before (skaffold.yaml)\napiVersion: skaffold/v1beta17\nkind: Config\n\n// after\napiVersion: skaffold/v2beta29\nkind: Config","handlingStrategy":"validation","validationCode":"// check all configs share the target version track before upgrading\nfor _, cfg := range cfgs {\n\tv := cfg.GetVersion()\n\tif (strings.HasPrefix(v, \"skaffold/v1\") && isV2Target) ||\n\t   (strings.HasPrefix(v, \"skaffold/v2\") && isV1Target) {\n\t\treturn fmt.Errorf(\"config %v cannot upgrade to %s; run `skaffold fix` first\", v, toVersion)\n\t}\n}","typeGuard":"func isSameTrack(version, target string) bool {\n\ttrack := func(v string) string {\n\t\tswitch {\n\t\tcase strings.Contains(v, \"v1\"): return \"v1\"\n\t\tcase strings.Contains(v, \"v2\"): return \"v2\"\n\t\tdefault: return \"unknown\"\n\t\t}\n\t}\n\treturn track(version) == track(target) && track(version) != \"unknown\"\n}","tryCatchPattern":"ok, err := schema.IsCompatibleWith(cfgs, toVersion)\nif err != nil {\n\tlog.Warnf(\"auto-upgrade refused: %v — run `skaffold fix` manually\", err)\n\treturn err // or fall back to manual migration\n}","preventionTips":["Keep apiVersion in skaffold.yaml on a supported version track","Run `skaffold fix` after each Skaffold minor upgrade","Never mix configs of different major tracks in one invocation","Pin the team's Skaffold version so configs and binary tracks stay aligned"],"tags":["skaffold","config","versioning","schema"],"backgroundTag":"schema-version-incompatible","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"}