{"record":{"id":"551ea0ede564f29c","repo":"kubernetes/kops","slug":"at-least-one-channel-url-is-required","errorCode":null,"errorMessage":"at least one channel URL is required","messagePattern":"at least one channel URL is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"channels/pkg/cmd/apply_channel.go","lineNumber":202,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tkubernetesVersionInfo, err := k8sClient.Discovery().ServerVersion()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error querying kubernetes version: %v\", err)\n\t}\n\n\tkubernetesVersion, err := semver.ParseTolerant(kubernetesVersionInfo.GitVersion)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot parse kubernetes version %q\", kubernetesVersionInfo.GitVersion)\n\t}\n\n\t// Remove Pre and Patch, as they make semver comparisons impractical\n\tkubernetesVersion.Pre = nil\n\n\tif len(args) == 0 {\n\t\treturn fmt.Errorf(\"at least one channel URL is required\")\n\t}\n\n\tvar merr error\n\tfor _, channelLocation := range args {\n\t\tmenu, err := buildMenu(f.VFSContext(), kubernetesVersion, channelLocation)\n\t\tif err != nil {\n\t\t\tmerr = multierr.Append(merr, fmt.Errorf(\"building menu for %q: %w\", channelLocation, err))\n\t\t\tcontinue\n\t\t}\n\t\tif err := applyMenu(ctx, menu, f.VFSContext(), k8sClient, cmClient, dynamicClient, restMapper, options.Yes); err != nil {\n\t\t\tmerr = multierr.Append(merr, fmt.Errorf(\"applying %q: %w\", channelLocation, err))\n\t\t}\n\t}\n\treturn merr\n}\n\nfunc applyMenu(ctx context.Context, menu *channels.AddonMenu, vfsContext *vfs.VFSContext, k8sClient kubernetes.Interface, cmClient certmanager.Interface, dynamicClient dynamic.Interface, restMapper *restmapper.DeferredDiscoveryRESTMapper, apply bool) error {\n\t// channelVersions is the list of installed addons in the cluster.","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/channels/pkg/cmd/apply_channel.go#L184-L220","documentation":"RunApplyChannel requires at least one channel location argument; it applies each URL/path given in args. With an empty args slice it returns this usage error before doing any work. This is a programmer/CLI misuse error, not an environment failure.","triggerScenarios":"Calling RunApplyChannel (or the `kops channels apply` command) with no channel arguments, e.g. `kops channels apply` with no channel URL, or a wrapper dropping the args slice.","commonSituations":"Scripting the CLI and forgetting the channel argument; calling the exported RunApplyChannel from Go code with args == nil; a config-driven wrapper that reads channel URLs from an empty list/env var.","solutions":["Pass at least one channel location, e.g. `kops channels apply --name <cluster> https://raw.githubusercontent.com/kubernetes/kops/master/channels/stable`","If wrapping RunApplyChannel in Go, ensure args contains the channel URLs you intend","Check the script/env var feeding the channel list is not empty","Note the CLI flag may be --channel in some invocations; verify with kops channels apply --help"],"exampleFix":"// before\nkops channels apply --name mycluster.example.com\n// after\nkops channels apply --name mycluster.example.com https://raw.githubusercontent.com/kubernetes/kops/master/channels/stable","handlingStrategy":"validation","validationCode":"// Go: check args before calling RunApplyChannel\nif len(args) == 0 {\n\treturn fmt.Errorf(\"no channel URLs configured; set at least one\")\n}\nerr := RunApplyChannel(ctx, f, out, options, args)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a channel URL argument (e.g. the stable channel URL) to kops channels apply","In wrappers, validate the channel list/env var is non-empty before exec","Check `kops channels apply --help` for correct flag/arg placement","Default to the upstream stable channel when no explicit channel is configured"],"tags":["cli","usage","validation","arguments"],"backgroundTag":"missing-required-argument","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"}