Skip to content

Fix MultipleKeysError when user condarc declares auto_activate#500

Merged
jezdez merged 1 commit intomainfrom
fix/multiplekeys-auto-activate
Apr 24, 2026
Merged

Fix MultipleKeysError when user condarc declares auto_activate#500
jezdez merged 1 commit intomainfrom
fix/multiplekeys-auto-activate

Conversation

@jezdez
Copy link
Copy Markdown
Member

@jezdez jezdez commented Apr 24, 2026

Summary

conda 25.11+ raises a hard error (MultipleKeysError) if both auto_activate and auto_activate_base appear in the same .condarc. writeCondaConfig was merging the user's condarc-file first (which may already declare auto_activate), then unconditionally writing auto_activate_base on top. Both keys ended up in the final .condarc and conda 25.11+ refused to start.

Observed in conda/conda-build run 24878641904: their .github/condarc sets auto_activate: True, which triggered the bug on every job.

What changed

  • writeCondaConfig now detects which alias is already present in the merged config and writes only that one. Defaults to auto_activate_base when neither is set (backward compat with conda < 25.5.0). The other alias is explicitly deleted before writing.
  • auto_activate added to BOOLEAN_CONDARC_KEYS so it gets coerced to a YAML boolean when used as the canonical key (same as auto_activate_base).
  • local_repodata_ttl added to KNOWN_CONDARC_KEYS -- it is a valid conda key that was missing from the allow-list, causing a spurious warning.
  • Regression tests added for all three cases: default (neither alias present), user condarc has auto_activate, user condarc has auto_activate_base.

conda 25.11+ raises a hard error if both auto_activate and
auto_activate_base appear in the same .condarc. writeCondaConfig was
merging the user's condarc-file first (which may contain auto_activate),
then unconditionally writing auto_activate_base on top, causing both keys
to appear in the final .condarc.

Fix: detect which alias is already present in the merged config and write
only that one. Default to auto_activate_base when neither is set, for
backward compat with older conda. Delete the other alias before writing.

Also add auto_activate to BOOLEAN_CONDARC_KEYS so it is coerced to a
YAML boolean when used as the canonical key.

Add local_repodata_ttl to KNOWN_CONDARC_KEYS to silence the spurious
unrecognized-key warning for a valid conda config key.

Fixes conda/conda-build CI failure (run 24878641904).
@jezdez jezdez requested a review from a team as a code owner April 24, 2026 09:38
@jezdez jezdez requested a review from dbast April 24, 2026 09:38
@github-actions
Copy link
Copy Markdown

API Docs Preview

Preview URL: https://deploy-preview-500--setup-miniconda.netlify.app
Commit: 56d37a9b17a7f92ceb217c2884a5b0a826b98c82

Updated on every push. Powered by Netlify.

@jezdez jezdez merged commit 8ee1f36 into main Apr 24, 2026
111 checks passed
@jezdez jezdez deleted the fix/multiplekeys-auto-activate branch April 24, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants