{"record":{"id":"7630937b874ac8c8","repo":"jdx/mise","slug":"enabled-accounts-were-prepared","errorCode":null,"errorMessage":"enabled accounts were prepared","messagePattern":"enabled accounts were prepared","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/bootstrap.rs","lineNumber":1143,"sourceCode":"    pub(super) async fn run(self) -> Result<()> {\n        if let Some(command) = self.command {\n            return command.run().await;\n        }\n        let mut config = Config::get().await?;\n        let mut hooks = system::hooks_from_config(&config);\n        let skip = self.skip_parts();\n        let accounts_enabled = !skip.contains(&BootstrapPart::Accounts);\n        let files_enabled = !skip.contains(&BootstrapPart::Files);\n        let configured_accounts =\n            if accounts_enabled || (cfg!(target_os = \"linux\") && files_enabled) {\n                Some(system::accounts::prepare_requests_from_config(&config)?)\n            } else {\n                None\n            };\n        let managed_accounts = accounts_enabled.then(|| {\n            configured_accounts\n                .as_ref()\n                .expect(\"enabled accounts were prepared\")\n        });\n        let secrets = system::secrets::resolve(&config, self.prompt_secrets)?;\n        let managed_system_files = if !files_enabled {\n            None\n        } else {\n            Some(system::managed_files::prepare_requests_from_config(\n                &config, &secrets,\n            )?)\n        };\n        if let Some((files, directories)) = &managed_system_files {\n            system::managed_files::validate_principals(\n                files,\n                directories,\n                configured_accounts.as_ref(),\n                accounts_enabled,\n            )?;\n        }\n        let services_enabled = !skip.contains(&BootstrapPart::Services);","sourceCodeStart":1125,"sourceCodeEnd":1161,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/cli/bootstrap.rs#L1125-L1161","documentation":"Internal invariant in `mise bootstrap` preflight. `configured_accounts` is computed as Some(...) whenever `accounts_enabled || (linux && files_enabled)` (src/cli/bootstrap.rs:1134-1139); `managed_accounts` unwraps it only inside `accounts_enabled.then(...)`, which implies the first disjunct was true, so the Option is always Some. This expect is a regression guard for refactors of the skip/BootstrapPart logic — it is not reachable through any combination of user flags in this code.","triggerScenarios":"Only a source change that makes the accounts part enabled while skipping `system::accounts::prepare_requests_from_config` (e.g. someone edits the condition at line 1134) — the process then panics during `mise bootstrap` preflight. No config or flag combination triggers it in shipped builds.","commonSituations":"Contributors refactoring BootstrapPart skip handling or accounts preflight; users on a broken custom build. Normal `mise bootstrap` runs, including --skip/--only combinations, never hit it.","solutions":["If hit as a user: update/pin a released mise — this is a bug in that build, not your config","Workaround: run `mise bootstrap --skip=accounts` to bypass the accounts branch","As a contributor: restore the invariant — prepare account requests whenever !skip.contains(&BootstrapPart::Accounts) before the unwrap","Report with MISE_DEBUG=1 and the panic backtrace at https://github.com/jdx/mise/issues"],"exampleFix":"// before (broken refactor):\nlet configured_accounts = (cfg!(target_os = \"linux\") && files_enabled)\n    .then(|| system::accounts::prepare_requests_from_config(&config).ok())\n    .flatten();\nlet managed_accounts = accounts_enabled.then(|| {\n    configured_accounts.as_ref().expect(\"enabled accounts were prepared\") // panics\n});\n\n// after: keep prepare condition a superset of accounts_enabled\nlet configured_accounts =\n    if accounts_enabled || (cfg!(target_os = \"linux\") && files_enabled) {\n        Some(system::accounts::prepare_requests_from_config(&config)?)\n    } else {\n        None\n    };","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Rust embedders: contain the panic and fall back to a partial bootstrap\nlet result = std::panic::catch_unwind(|| {\n    // block_on(mise bootstrap) equivalent\n});\nif result.is_err() { run_bootstrap_with_skip(\"accounts\")?; }","preventionTips":["Pin a released mise version in CI rather than building random revisions","Report panics with MISE_DEBUG=1 backtraces to https://github.com/jdx/mise/issues","Know your escape hatch: mise bootstrap --skip=<part> bypasses the failing part"],"tags":["bootstrap","invariant","panic","internal","accounts"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}