Skip to content

Fix nil pointer crash when updating OCI chart dependencies - #11

Merged
schnell3526 merged 3 commits into
mainfrom
fix/oci-dependency-update-crash
Jan 31, 2026
Merged

Fix nil pointer crash when updating OCI chart dependencies#11
schnell3526 merged 3 commits into
mainfrom
fix/oci-dependency-update-crash

Conversation

@schnell3526

Copy link
Copy Markdown
Owner

Summary

Backport fix for nil pointer dereference crash when dependency_update is enabled with OCI registry charts.

Upstream Reference

Problem

When dependency_update is enabled and chart dependencies use OCI registries, the downloader.Manager was created without the RegistryClient field set. This causes a nil pointer dereference when the downloader tries to resolve version constraints.

Local Verification

Reproduced and verified the fix locally:

  1. Started local OCI registry (docker run -d -p 5001:5000 registry:2)
  2. Created test chart with OCI dependency (oci://localhost:5001/charts)
  3. Before fix: panic: runtime error: invalid memory address or nil pointer dereference at registry.(*Client).Tags(0x0, ...)
  4. After fix: terraform plan succeeded

Why No Automated Tests

OCI registry integration tests require:

  • Running a container registry in CI
  • Pushing test charts before each test
  • Managing authentication scenarios

This adds significant CI complexity for a minimal code change (+2 lines). The fix is straightforward and was verified manually.

Changes

  • helm/resource_helm_release.go: Add RegistryClient to downloader.Manager
  • helm/data_helm_template.go: Add RegistryClient to downloader.Manager
  • README.md: Add migration guide and update changes list

Closes #5

@schnell3526 schnell3526 self-assigned this Jan 31, 2026
efoncubierta and others added 3 commits January 31, 2026 23:09
When dependency_update is enabled and chart dependencies use OCI registries,
the downloader.Manager was created without the RegistryClient field set.
This caused a nil pointer dereference when the downloader tried to resolve
version constraints (like ~1.0.0) that require listing tags from the registry.

The fix adds RegistryClient to the Manager initialization in both:
- resource_helm_release.go (helm_release resource)
- data_helm_template.go (helm_template data source)

This allows the downloader to properly authenticate and communicate with
OCI registries when fetching chart dependencies.

Fixes: panic: runtime error: invalid memory address or nil pointer dereference
in helm.sh/helm/v3/pkg/registry.(*Client).Tags
Release notes will be managed manually in CHANGELOG.md
- Add simple migration steps from hashicorp/helm
- Add OCI dependency update fix to changes list
@schnell3526
schnell3526 force-pushed the fix/oci-dependency-update-crash branch from dd1e550 to d2aa519 Compare January 31, 2026 14:09
@schnell3526
schnell3526 merged commit b68c850 into main Jan 31, 2026
12 checks passed
@schnell3526
schnell3526 deleted the fix/oci-dependency-update-crash branch January 31, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backport: Fix nil pointer crash when updating OCI chart dependencies

2 participants