{"record":{"id":"e956f28b0a6f55f6","repo":"kubernetes/kops","slug":"failed-on-file-asset-s-is-invalid-unable-to-dec","errorCode":null,"errorMessage":"failed on file asset: %s is invalid, unable to decode base64, error: %q","messagePattern":"failed on file asset: (.+?) is invalid, unable to decode base64, error: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodeup/pkg/model/file_assets.go","lineNumber":70,"sourceCode":"func (f *FileAssetsBuilder) buildFileAssets(c *fi.NodeupModelBuilderContext, assets []kops.FileAssetSpec, tracker map[string]bool) error {\n\tfor _, asset := range assets {\n\t\t// @check if e have a path and if not use the default path\n\t\tassetPath := asset.Path\n\t\tif assetPath == \"\" {\n\t\t\tassetPath = filepath.Join(f.FileAssetsDefaultPath(), asset.Name)\n\t\t}\n\t\t// @check if the file has already been done and skip\n\t\tif _, found := tracker[assetPath]; found {\n\t\t\tcontinue\n\t\t}\n\t\ttracker[assetPath] = true // update the tracker\n\n\t\t// @check is the contents requires decoding\n\t\tcontent := asset.Content\n\t\tif asset.IsBase64 {\n\t\t\tdecoded, err := base64.RawStdEncoding.DecodeString(content)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed on file asset: %s is invalid, unable to decode base64, error: %q\", asset.Name, err)\n\t\t\t}\n\t\t\tcontent = string(decoded)\n\t\t}\n\n\t\t// If not specified, the default Mode is 0440\n\t\tif asset.Mode == \"\" {\n\t\t\tasset.Mode = \"0440\"\n\t\t}\n\n\t\t// We use EnsureTask so that we don't have to check if the asset directories have already been done\n\t\tc.EnsureTask(&nodetasks.File{\n\t\t\tPath: filepath.Dir(assetPath),\n\t\t\tType: nodetasks.FileType_Directory,\n\t\t\tMode: s(\"0755\"),\n\t\t})\n\n\t\tc.AddTask(&nodetasks.File{\n\t\t\tContents: fi.NewStringResource(content),","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/nodeup/pkg/model/file_assets.go#L52-L88","documentation":"FileAssetsBuilder.buildFileAssets wraps a base64.DecodeString failure when a file asset is marked as requiring base64 decoding (IsBase64/encoding set) but its Content is not valid base64. It names the offending asset path and echoes the decode error; the cluster spec's fileAssets content must be corrected or the base64 flag removed.","triggerScenarios":"Thrown at nodeup/pkg/model/file_assets.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the base64 data in the cluster spec file asset","Remove trailing whitespace/newlines from the base64 string","Drop base64 encoding if content is plain text"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}