Fix MultipleKeysError when user condarc declares auto_activate#500
Merged
Fix MultipleKeysError when user condarc declares auto_activate#500
Conversation
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).
API Docs PreviewPreview URL: https://deploy-preview-500--setup-miniconda.netlify.app Updated on every push. Powered by Netlify. |
dbast
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
conda 25.11+ raises a hard error (
MultipleKeysError) if bothauto_activateandauto_activate_baseappear in the same.condarc.writeCondaConfigwas merging the user'scondarc-filefirst (which may already declareauto_activate), then unconditionally writingauto_activate_baseon top. Both keys ended up in the final.condarcand conda 25.11+ refused to start.Observed in conda/conda-build run 24878641904: their
.github/condarcsetsauto_activate: True, which triggered the bug on every job.What changed
writeCondaConfignow detects which alias is already present in the merged config and writes only that one. Defaults toauto_activate_basewhen neither is set (backward compat with conda < 25.5.0). The other alias is explicitly deleted before writing.auto_activateadded toBOOLEAN_CONDARC_KEYSso it gets coerced to a YAML boolean when used as the canonical key (same asauto_activate_base).local_repodata_ttladded toKNOWN_CONDARC_KEYS-- it is a valid conda key that was missing from the allow-list, causing a spurious warning.auto_activate, user condarc hasauto_activate_base.