jdx/mise · error
trusted settings resolution requires the base settings to…
Error message
trusted settings resolution requires the base settings to be loaded
What it means
When the trust policy is TrustedOnly, mise resolves settings using only config files that have been explicitly trusted. This check in `Settings::load_sources_from` refuses to resolve trusted settings before the base settings (which record which files are trusted) have been loaded, because trust decisions would otherwise be made from incomplete data. It is a guard against resolving settings too early in the bootstrap sequence.
Solutions
- Ensure the base settings are loaded first (call the normal settings load / config load entry point) before resolving with TrustedOnly policy.
- If trusted-only resolution is not actually required, use a load policy without SettingsTrustPolicy::TrustedOnly.
- If you hit this in the mise codebase, move the call site later in the bootstrap sequence so `is_loaded()` returns true.
Example fix
// before let settings = Settings::load_sources_from(root, Some(SettingsLoadPolicy::trusted_only()), None)?; // after config::load_ignoring_global_config()?; // ensures base settings loaded let settings = Settings::load_sources_from(root, Some(SettingsLoadPolicy::trusted_only()), None)?;
Defensive patterns
Strategy: try-catch
Validate before calling
// rust: only resolve with TrustedOnly after base settings loaded
if policy.trust == SettingsTrustPolicy::TrustedOnly && !settings::is_loaded() {
return Err(anyhow!("resolve base settings before trusted-only resolution"));
} Try / catch
// call settings resolution inside a context that guarantees prior config::load let settings = config::load()?.settings;
Prevention
- Always bootstrap via the normal config::load entry point before custom settings resolution.
- Avoid TrustedOnly policy unless you specifically need it.
- Add an assertion in tests that is_loaded() is true before trusted resolution paths run.
When it happens
Trigger: Calling settings resolution with a SettingsLoadPolicy whose trust is SettingsTrustPolicy::TrustedOnly while `Settings::is_loaded()` is still false — i.e. requesting trusted-only resolution before the initial base-settings load has completed.
Common situations: Internal ordering bugs in custom config loading paths or plugins that call settings resolution before mise finished its normal startup load; code that resolves trusted config during early CLI parsing before the trusted-files registry exists.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- conflicting pypi and pipx settings in the same file
- conflicting pypi. and pipx. settings
- history is disabled (history.enabled = false); nothing can…
- invalid value ; expected one of
- manager ' ' is excluded by the system_packages.managers…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/fc26fe2ac69c52aa.
Report an issue: GitHub.
Appendix: source
Thrown at src/config/settings.rs:1003
Self::load_sources_from(None, SettingsLoadPolicy::ENVIRONMENT_ONLY).ok()?;
normalize_verbosity(&mut settings);
Some(settings.log_level())
}
/// Load settings sources for an explicit root, or the current directory when `root` is `None`.
///
/// This shares source ordering and file parsing with the normal settings load. It deliberately
/// does not update process-global settings state or apply the post-load process side effects in
/// [`Self::try_get`]. Root-specific callers can require trusted project files without
/// reproducing config discovery or precedence rules.
fn load_sources_from(root: Option<&Path>, policy: SettingsLoadPolicy) -> Result<Self> {
let policy = if PACKAGE_QUERY_SETTINGS.load(Ordering::Relaxed) {
SettingsLoadPolicy::ENVIRONMENT_ONLY
} else {
policy
};
if policy.trust == SettingsTrustPolicy::TrustedOnly && !is_loaded() {
bail!("trusted settings resolution requires the base settings to be loaded");
}
let mut builder = Self::builder().preloaded(Self::cli_settings_layer());
if [
"MISE_PYPI_UVX",
"MISE_PIPX_UVX",
"MISE_PYPI_REGISTRY_URL",
"MISE_PIPX_REGISTRY_URL",
]
.iter()
.any(|name| std::env::var_os(name).is_some())
{
let mut env_aliases = Self::builder().env().load()?;
env_aliases.normalize_pypi_aliases()?;
let mut alias_layer = SettingsPartial::default();
// Normalize the environment as its own source before layering it over files.
if std::env::var_os("MISE_PYPI_UVX").is_some()
|| std::env::var_os("MISE_PIPX_UVX").is_some()
{View on GitHub (pinned to 533346cc37)