{"record":{"id":"9c768381601449c6","repo":"kubernetes/kops","slug":"error-parsing-channel-v","errorCode":null,"errorMessage":"error parsing channel %v","messagePattern":"error parsing channel (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/kops/channel.go","lineNumber":162,"sourceCode":"\tchannelBytes, err := vfsContext.ReadFile(resolved)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading channel %q: %v\", resolved, err)\n\t}\n\tchannel, err := ParseChannel(channelBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing channel %q: %v\", resolved, err)\n\t}\n\tklog.V(4).Infof(\"Channel contents: %s\", string(channelBytes))\n\n\treturn channel, nil\n}\n\n// ParseChannel parses a Channel object\nfunc ParseChannel(channelBytes []byte) (*Channel, error) {\n\tchannel := &Channel{}\n\terr := ParseRawYaml(channelBytes, channel)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing channel %v\", err)\n\t}\n\n\treturn channel, nil\n}\n\n// FindRecommendedUpgrade returns a string with a new version, if the current version is out of date\nfunc (v *KubernetesVersionSpec) FindRecommendedUpgrade(version semver.Version) (*semver.Version, error) {\n\tif v.RecommendedVersion == \"\" {\n\t\tklog.V(2).Infof(\"VersionRecommendationSpec does not specify RecommendedVersion\")\n\t\treturn nil, nil\n\t}\n\n\trecommendedVersion, err := util.ParseKubernetesVersion(v.RecommendedVersion)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing RecommendedVersion %q from channel\", v.RecommendedVersion)\n\t}\n\tif recommendedVersion.GT(version) {\n\t\tklog.V(2).Infof(\"RecommendedVersion=%q, Have=%q.  Recommending upgrade\", recommendedVersion, version)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/apis/kops/channel.go#L144-L180","documentation":"ParseChannel deserializes raw channel bytes into the Channel struct via ParseRawYaml. This error wraps whatever ParseRawYaml returned — YAML syntax errors, type mismatches (string where int expected), or unknown/duplicated fields — while reading a kOps channel file.","triggerScenarios":"ParseChannel called with bytes that are not valid YAML for the Channel type: tab indentation, wrong scalar types (recommendedVersion: 1.28 as float-like), unknown fields rejected by strict parsing, duplicated keys.","commonSituations":"Hand-edited channel files; YAML editors converting version numbers to floats (1.10 -> 1.1); copy/paste from docs losing indentation; tooling emitting JSON with mismatched field types; tabs instead of spaces.","solutions":["Read the wrapped inner error to find the exact line/field that failed.","Run the file through yamllint and fix syntax issues (no tabs, consistent indentation).","Quote all version strings (recommendedVersion: \"1.28.3\") so YAML does not coerce them to numbers.","Remove or correct unknown/misnamed fields; compare against the upstream channel file structure."],"exampleFix":"// before\nkubernetesVersion:\n  recommendedVersion: 1.10\n// after\nkubernetesVersion:\n  recommendedVersion: \"1.10.13\"","handlingStrategy":"validation","validationCode":"var strict kops.Channel\nif err := yaml.UnmarshalStrict(channelBytes, &strict); err != nil {\n    return fmt.Errorf(\"channel schema invalid: %w\", err)\n}","typeGuard":"func parsesAsChannel(b []byte) (bool, error) {\n    var c kops.Channel\n    err := kops.ParseRawYaml(b, &c)\n    return err == nil, err\n}","tryCatchPattern":"channel, err := kops.ParseChannel(bytes)\nif err != nil {\n    // surface the wrapped yaml error to the user with file/line context\n    return fmt.Errorf(\"channel file invalid: %w\", err)\n}","preventionTips":["Quote all version strings in channel YAML to prevent numeric coercion","Use spaces, never tabs, in channel files","Validate with yaml.UnmarshalStrict in CI before publishing channels"],"tags":["kops","channel","yaml","schema-validation"],"backgroundTag":"yaml-parse-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"}