{"record":{"id":"1733c1f8b4f6fc08","repo":"GoogleContainerTools/skaffold","slug":"upgrading-main-pipeline-w","errorCode":null,"errorMessage":"upgrading main pipeline: %w","messagePattern":"upgrading main pipeline: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/util/upgrade_pipelines.go","lineNumber":66,"sourceCode":"\t\tupgrade:   upgrade,\n\t}\n\n\tif err := upgrader.mainPipeline(); err != nil {\n\t\treturn err\n\t}\n\n\treturn upgrader.profiles()\n}\n\nfunc (u *pipelineUpgrader) mainPipeline() error {\n\tconst fieldMainPipeline = \"Pipeline\"\n\n\toldPipeline := u.oldConfig.FieldByName(fieldMainPipeline).Addr().Interface()\n\tnewPipeline := u.newConfig.FieldByName(fieldMainPipeline).Addr().Interface()\n\n\terr := u.upgrade(oldPipeline, newPipeline)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"upgrading main pipeline: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (u *pipelineUpgrader) profiles() error {\n\tconst (\n\t\tfieldProfilePipeline = \"Pipeline\"\n\t\tfieldProfiles        = \"Profiles\"\n\t)\n\n\tprofilesOld := u.oldConfig.FieldByName(fieldProfiles)\n\tprofilesNew := u.newConfig.FieldByName(fieldProfiles)\n\n\tif profilesOld.Len() != profilesNew.Len() {\n\t\treturn fmt.Errorf(\"lengths of old and new profiles differ\")\n\t}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/util/upgrade_pipelines.go#L48-L84","documentation":"pipelineUpgrader.mainPipeline upgrades the top-level 'pipeline' section of a skaffold config via reflection (FieldByName) and invokes the versioned upgrade function. If that upgrade call returns an error, it is wrapped with this prefix so the caller knows the failure was in the main pipeline, not in a profile. The wrapped cause (e.g. an unsupported-field error from the versioned Upgrade) is preserved with %w.","triggerScenarios":"Calling UpgradePipelines on a config whose main pipeline section fails the versioned Upgrade() — e.g. it contains fields removed in the target version (like build.acr) or an incompatible structure the upgrade function rejects.","commonSituations":"Running skaffold on an older skaffold.yaml targeting a newer schema where a top-level deploy/build feature was dropped; configs with both legacy and new deploy blocks that the upgrade logic cannot reconcile.","solutions":["Inspect the wrapped cause (%w chain) to see which main-pipeline field the upgrade rejected","Edit skaffold.yaml to remove or migrate the unsupported main-pipeline field, then retry the upgrade","Use `skaffold fix` to regenerate the config at the target version"],"exampleFix":"// before (skaffold.yaml)\nbuild:\n  acr: {...}\n// after\nbuild:\n  artifacts: [...]","handlingStrategy":"validation","validationCode":"if cfg.Build == nil || cfg.Deploy == nil { return errors.New(\"config missing required sections\") }","typeGuard":null,"tryCatchPattern":"err := util.UpgradePipelines(old, new, u.upgrade)\nif err != nil {\n\tvar inner error\n\tif errors.As(err, &inner) && strings.Contains(err.Error(), \"upgrading main pipeline\") {\n\t\t// inspect inner cause\n\t}\n}","preventionTips":["Keep the main pipeline section aligned with the target schema before upgrading","Run skaffold fix to handle automated migrations","Audit removed fields (release notes) before upgrading schema versions"],"tags":["go","schema-upgrade","reflection"],"backgroundTag":"schema-upgrade-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"}