Skip to content

fix(downloader): do not error for remote chart when local repo cache is missing - #32648

Open
aadieng100 wants to merge 1 commit into
helm:mainfrom
aadieng100:fix/missing-repo-cache-chart-url
Open

aadieng100 wants to merge 1 commit into
helm:mainfrom
aadieng100:fix/missing-repo-cache-chart-url

Conversation

@aadieng100

Copy link
Copy Markdown

What this PR does / why we need it:
When resolving an absolute chart URL, scanReposForURL scans known repositories to check if any match the chart URL in order to apply repository-specific TLS or authentication options.

Previously, if any repository in repositories.yaml lacked a local cached index file (for example because the cache was cleared or never updated), scanReposForURL immediately aborted with an error (no cached repo found. (try 'helm repo update')). This caused ResolveChartVersion to fail completely, preventing the user from downloading or templating an unrelated remote chart even when fetching directly by URL or when another repository had a valid cache.

This change skips repositories whose index cache does not exist (fs.ErrNotExist) rather than returning an early error. If no repository matches, ErrNoOwnerRepo is returned and swallowed by ResolveChartVersion to fall back to the default HTTP client as intended.

closes #11961

Special notes for your reviewer:

  • Unlike a previous abandoned PR (fix: do not error for remote chart if there's a missing local repo cache #11963), the shared ErrNoOwnerRepo error sentinel message is intentionally kept unchanged, preserving SDK error stability.
  • Added comprehensive unit tests in pkg/downloader/chart_downloader_test.go verifying:
    • scanReposForURL returns ErrNoOwnerRepo when repository cache is empty.
    • scanReposForURL skips unrelated repos with missing cache files and successfully finds a matching repository when present.
    • ResolveChartVersion successfully resolves direct chart URLs with an empty repository cache.

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

…is missing

When resolving an absolute chart URL, scanReposForURL scans known repositories to check if any match the chart URL in order to apply repository-specific TLS or authentication options.

Previously, if any repository in repositories.yaml lacked a local cached index file (for example because the cache was cleared or never updated), scanReposForURL immediately aborted with an error ('no cached repo found'). This caused ResolveChartVersion to fail completely, preventing the user from downloading or templating an unrelated remote chart even when fetching directly by URL or when another repository had a valid cache.

This change skips repositories whose index cache does not exist (fs.ErrNotExist) rather than returning an early error. If no repository matches, ErrNoOwnerRepo is returned and swallowed by ResolveChartVersion to fall back to the default HTTP client as intended.

Closes helm#11961

Signed-off-by: abdouladieng <diengabdoulaziz110@gmail.com>
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 14, 2026
@github-actions github-actions Bot added the v4.x Issues and Pull Requests related to the major version v4 label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. v4.x Issues and Pull Requests related to the major version v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm fails to retrieve a remote chart if there are local repos that are not cached

1 participant