Skip to content

panic: runtime error: invalid memory address or nil pointer dereference #6910

@huhouhua

Description

@huhouhua

Bug Report

What did you do?

I tried to execute this generate a project

operator-sdk create api --group app --version v1 --kind Redis --helm-chart-repo https://charts.bitnami.com/bitnami --helm-chart redis

What did you expect to see?

Successfully created

What did you see instead? Under which circumstances?

program pointer error, specific output results

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x2364c2f]

goroutine 1 [running]:
helm.sh/helm/v3/pkg/registry.(*Client).Tags(0x0, {0xc00931bdc6?, 0xc000a0f0c8?})
        /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.16.3/pkg/registry/client.go:671 +0x10f
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).getOciURI(0xc000a0f4f8, {0xc00931bdc0, 0x36}, {0x0, 0x0}, 0xc00310e090)
        /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.16.3/pkg/downloader/chart_downloader.go:154 +0x128
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).ResolveChartVersion(0xc000a0f4f8, {0xc00931bdc0, 0x36}, {0x0, 0x0})
        /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.16.3/pkg/downloader/chart_downloader.go:199 +0xfd2
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).DownloadTo(0xc000a0f4f8, {0xc00931bdc0, 0x36}, {0x0?, 0x0?}, {0xc0001f7300, 0x1e})
        /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.16.3/pkg/downloader/chart_downloader.go:90 +0x4f
github.com/operator-framework/operator-sdk/internal/plugins/helm/v1/chartutil.downloadChart({0xc0001f7300, 0x1e}, {{0xc00931bdc0, 0x36}, {0x7ffdc2ec001f, 0x22}, {0x0, 0x0}})
        internal/plugins/helm/v1/chartutil/chart.go:144 +0x35b
github.com/operator-framework/operator-sdk/internal/plugins/helm/v1/chartutil.LoadChart({{0x7ffdc2ec004f, 0x5}, {0x7ffdc2ec001f, 0x22}, {0x0, 0x0}})
        internal/plugins/helm/v1/chartutil/chart.go:117 +0x13c
github.com/operator-framework/operator-sdk/internal/plugins/helm/v1.(*createAPISubcommand).InjectResource(0xc000943970, 0x28b1660?)
        internal/plugins/helm/v1/api.go:169 +0x276
sigs.k8s.io/kubebuilder/v4/pkg/cli.(*CLI).applySubcommandHooks.(*executionHooksFactory).preRunEFunc.func1.2({0x7efdf4df6810?, 0xc000943970?})
        /home/runner/go/pkg/mod/sigs.k8s.io/kubebuilder/v4@v4.2.0/pkg/cli/cmd_helpers.go:275 +0x4a
sigs.k8s.io/kubebuilder/v4/pkg/cli.(*executionHooksFactory).forEach(0xc0000fc9a0, 0xc000a0fb50, {0x2c11479, 0x20})
        /home/runner/go/pkg/mod/sigs.k8s.io/kubebuilder/v4@v4.2.0/pkg/cli/cmd_helpers.go:198 +0x9e
sigs.k8s.io/kubebuilder/v4/pkg/cli.(*CLI).applySubcommandHooks.(*executionHooksFactory).preRunEFunc.func1(0xc00072e608?, {0xc0007eb0e0?, 0x0?, 0xa?})
        /home/runner/go/pkg/mod/sigs.k8s.io/kubebuilder/v4@v4.2.0/pkg/cli/cmd_helpers.go:273 +0x505
github.com/spf13/cobra.(*Command).execute(0xc00072e608, {0xc0007eafa0, 0xa, 0xa})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:970 +0xa24
github.com/spf13/cobra.(*Command).ExecuteC(0xc00096b508)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
sigs.k8s.io/kubebuilder/v4/pkg/cli.CLI.Run(...)
        /home/runner/go/pkg/mod/sigs.k8s.io/kubebuilder/v4@v4.2.0/pkg/cli/cli.go:463
github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli.Run()
        internal/cmd/operator-sdk/cli/cli.go:66 +0x45
main.main()
        cmd/operator-sdk/main.go:28 +0x13

Environment

Operator type:

helm

Kubernetes cluster type:

$ operator-sdk version

operator-sdk version: "v1.39.1", commit: "b8a728e15447465a431343a664e9a27ff9db655e", kubernetes version: "1.31.0", go version: "go1.23.4", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.22.4 linux/amd64

$ kubectl version

Possible Solution

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions