{"record":{"id":"43e3fb3c059a1993","repo":"jdx/mise","slug":"unknown-bootstrap-hook-phase-phase-raw-valid","errorCode":null,"errorMessage":"unknown bootstrap hook phase {phase_raw:?}; valid phases are: {}","messagePattern":"unknown bootstrap hook phase (.+?); valid phases are: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/hooks.rs","lineNumber":82,"sourceCode":"\n#[derive(Debug, Clone, PartialEq, Eq)]\npub(crate) struct BootstrapHook {\n    pub phase: BootstrapHookPhase,\n    pub run: String,\n    pub config_path: PathBuf,\n}\n\nimpl BootstrapHook {\n    pub(crate) fn from_toml(\n        phase_raw: &str,\n        value: toml::Value,\n        config_path: PathBuf,\n    ) -> Result<Vec<Self>> {\n        let Some(phase) = BootstrapHookPhase::parse(phase_raw) else {\n            let valid = BootstrapHookPhase::iter()\n                .map(|phase| phase.as_str())\n                .collect::<Vec<_>>();\n            bail!(\n                \"unknown bootstrap hook phase {phase_raw:?}; valid phases are: {}\",\n                valid.join(\", \")\n            );\n        };\n        let runs = match value {\n            toml::Value::String(run) => vec![run],\n            toml::Value::Array(values) => string_array(values, \"expected string commands\")?,\n            toml::Value::Table(mut table) => match table.remove(\"run\") {\n                Some(toml::Value::String(run)) => vec![run],\n                Some(toml::Value::Array(values)) => {\n                    string_array(values, \"expected `run` to contain string commands\")?\n                }\n                Some(_) => bail!(\"expected `run` to be a string or array of strings\"),\n                None => bail!(\"expected a `run` command\"),\n            },\n            _ => bail!(\"expected a string, array of strings, or table with `run`\"),\n        };\n        let hooks = runs","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/hooks.rs#L64-L100","documentation":"Bootstrap hooks in mise.toml declare a `phase` key that must name a valid BootstrapHookPhase. from_toml parses the phase string and bails with the list of accepted values when parse fails, so a typo cannot silently disable a hook.","triggerScenarios":"Defining a [[hook]] table in a config file whose phase value doesn't match any BootstrapHookPhase variant, e.g. `phase = \"preboot\"` or `phase = \"BeforeRun\"` (case/word mismatch).","commonSituations":"Typo in the phase name; copying an example with an outdated phase name; guessing phase names instead of consulting docs; wrong capitalization.","solutions":["Set phase to one of the values listed in the error message (case-sensitive).","Check mise docs for the current list of bootstrap hook phases.","Remove the hook table if it was experimental and no longer supported."],"exampleFix":"// before (mise.toml)\n[[hooks]]\nphase = \"startup\"\nrun = \"echo hi\"\n// after (use a valid phase from the message)\n[[hooks]]\nphase = \"pretool\"\nrun = \"echo hi\"","handlingStrategy":"validation","validationCode":"const VALID_PHASES: &[&str] = &[/* phases listed in the error message */];\nfn valid_phase(p: &str) -> bool { VALID_PHASES.contains(&p) }","typeGuard":"fn parse_phase(p: &str) -> Option<Phase> { VALID_PHASES.iter().find(|v| **v == p).map(|v| Phase(*v)) }","tryCatchPattern":"match load_hooks(config) {\n  Err(e) if e.to_string().contains(\"unknown bootstrap hook phase\") => eprintln!(\"{} — see docs for valid phases\", e),\n  other => other?,\n}","preventionTips":["Copy phase names from the official docs, never from memory.","Keep a schema/linter for mise.toml to validate hook tables.","Test hook configs with a dry run before committing."],"tags":["config","hooks","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}