{"record":{"id":"fc5b7940cd7b3317","repo":"kubernetes/kops","slug":"error-loading-templates-v","errorCode":null,"errorMessage":"error loading templates: %v","messagePattern":"error loading templates: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":550,"sourceCode":"\tnodeUpAssets, err := nodemodel.BuildNodeUpAssets(ctx, assetBuilder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfigBuilder, err := nodemodel.NewNodeUpConfigBuilder(cluster, assetBuilder, encryptionConfigSecretHash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbootstrapScriptBuilder := &model.BootstrapScriptBuilder{\n\t\tKopsModelContext:    modelContext,\n\t\tLifecycle:           clusterLifecycle,\n\t\tNodeUpConfigBuilder: configBuilder,\n\t\tNodeUpAssets:        nodeUpAssets.NodeUpAssets,\n\t}\n\n\t{\n\t\ttemplates, err := templates.LoadTemplates(ctx, models.NewAssetPath(\"cloudup/resources\"))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error loading templates: %v\", err)\n\t\t}\n\n\t\tbcb := bootstrapchannelbuilder.NewBootstrapChannelBuilder(\n\t\t\tmodelContext,\n\t\t\tclusterLifecycle,\n\t\t\tassetBuilder,\n\t\t\ttemplates,\n\t\t\taddons,\n\t\t\taddonRenderer,\n\t\t)\n\n\t\tl.Builders = append(l.Builders,\n\n\t\t\tbcb,\n\t\t\t&model.PKIModelBuilder{\n\t\t\t\tKopsModelContext: modelContext,\n\t\t\t\tLifecycle:        clusterLifecycle,\n\t\t\t},","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L532-L568","documentation":"After building model context, Run loads the built-in cloudup resource templates via templates.LoadTemplates. If reading or parsing those template assets fails, the error is wrapped as 'error loading templates'. This almost always indicates a corrupted or incomplete kOps installation (missing embedded assets) rather than user configuration.","triggerScenarios":"templates.LoadTemplates(ctx, models.NewAssetPath(\"cloudup/resources\")) returns an error during `kops update cluster` — e.g. broken binary build without embedded assets, or a tampered/truncated install.","commonSituations":"Locally built kOps binary from a dirty checkout; unusual GOOS/GOARCH cross-compile dropping embedded files; filesystem issues reading the binary's assets; old binary incompatible with modified model paths in forks.","solutions":["Rebuild/reinstall kOps from a clean checkout: `make kops` (or download an official release)","Verify the failing template path exists in your source tree if building from source","Run `kops version` and ensure the binary matches your checkout/version expectations"],"exampleFix":"// before: broken local build\n./kops update cluster ...  # error loading templates\n// after\ngit checkout main && make kops && .build/dist/linux/amd64/kops update cluster ...","handlingStrategy":"try-catch","validationCode":"kops version && [ -x \"$(command -v kops)\" ] || echo \"reinstall kops from official release\"","typeGuard":null,"tryCatchPattern":"templates, err := templates.LoadTemplates(ctx, path); if err != nil { return fmt.Errorf(\"error loading templates: %w; reinstall kops from a clean build\", err) }","preventionTips":["Install kOps from official releases, not ad-hoc builds","Rebuild cleanly (`make clean && make kops`) after switching branches","Verify binaries with checksums after download"],"tags":["templates","assets","installation"],"backgroundTag":"template-load-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}