{"record":{"id":"e02e846e18912e73","repo":"kubernetes/kops","slug":"error-parsing-channel-q-v","errorCode":null,"errorMessage":"error parsing channel %q: %v","messagePattern":"error parsing channel %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/kops/channel.go","lineNumber":150,"sourceCode":"\tresolvedURL, err := ResolveChannel(location)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resolvedURL == nil {\n\t\treturn &Channel{}, nil\n\t}\n\n\tresolved := resolvedURL.String()\n\n\tklog.V(2).Infof(\"Loading channel from %q\", resolved)\n\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","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/apis/kops/channel.go#L132-L168","documentation":"After the channel bytes are read successfully, LoadChannel hands them to ParseChannel. This error means the file was fetched but its content could not be parsed as a kOps channel YAML document. The wrapped %v carries the YAML/schema detail (bad indentation, unknown fields in strict mode, wrong root kind).","triggerScenarios":"LoadChannel where ParseChannel(channelBytes) fails: the URL points to an HTML error page, an empty file, or a YAML document that does not match the Channel schema (wrong apiVersion/kind, malformed YAML).","commonSituations":"A proxy or captive portal returns an HTML 200 page instead of YAML; a hand-edited channel file with a YAML syntax error; channel file saved with wrong content (e.g. a cluster spec pasted in); truncated download.","solutions":["curl the resolved channel URL and inspect the body — if it is HTML or empty, fix the URL/network path first.","Validate the channel file YAML syntax (yamllint) and that it declares the expected Channel apiVersion/kind.","If the channel is custom, start from the upstream channel file as a template and re-apply edits carefully.","Check for proxy/captive-portal interference returning error pages with HTTP 200."],"exampleFix":"// before (channel.yaml)\nkind: Channle\nspec: {}\n// after\napiVersion: kops.k8s.io/v1alpha1\nkind: Channel\nspec:\n  kubernetesVersion:\n    recommendedVersion: 1.28.3","handlingStrategy":"validation","validationCode":"var probe map[string]interface{}\nif err := yaml.Unmarshal(channelBytes, &probe); err != nil {\n    return fmt.Errorf(\"not valid YAML: %w\", err)\n}\nif probe[\"kind\"] != \"Channel\" {\n    return fmt.Errorf(\"unexpected kind %v; is the URL returning HTML?\", probe[\"kind\"])\n}","typeGuard":"func looksLikeChannel(b []byte) bool {\n    var c kops.Channel\n    return yaml.Unmarshal(b, &c) == nil && c.Kind == \"Channel\"\n}","tryCatchPattern":"channel, err := kops.LoadChannel(vfsContext, location)\nif err != nil && strings.Contains(err.Error(), \"error parsing channel\") {\n    // log first 200 bytes of the body for diagnosis, then fail fast\n}","preventionTips":["curl the channel URL and confirm the body is YAML, not an HTML error page","Lint custom channel files with yamllint before publishing","Start edits from the upstream channel file as a template"],"tags":["kops","channel","yaml","parsing"],"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"}