{"record":{"id":"bc38dca73ab66d1c","repo":"jdx/mise","slug":"expected-a-string-array-of-strings-or-table-with","errorCode":null,"errorMessage":"expected a string, array of strings, or table with `run`","messagePattern":"expected a string, array of strings, or table with `run`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/hooks.rs","lineNumber":98,"sourceCode":"                .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\n            .into_iter()\n            .filter_map(|run| {\n                let run = run.trim().to_string();\n                if run.is_empty() {\n                    warn!(\"[bootstrap.hooks.{phase}]: empty command, ignoring entry\");\n                    None\n                } else {\n                    Some(Self {\n                        phase,\n                        run,\n                        config_path: config_path.clone(),\n                    })\n                }\n            })\n            .collect();\n        Ok(hooks)","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/hooks.rs#L80-L116","documentation":"This error comes from Hook::from_toml in src/system/hooks.rs when parsing a hook's `run` field from a TOML config. Hooks accept either a plain string, an array of strings (multiple commands), or a table containing a `run` key; any other TOML type (integer, boolean, nested table without `run`, etc.) is rejected with this message. It is a configuration schema-validation guard so malformed hook definitions fail at parse time instead of at hook execution.","triggerScenarios":"Setting `run` (or a hook entry) to a TOML type other than string/array-of-strings/table-with-`run`: e.g. run = 42, run = true, run = { cmd = \"...\" }, or a deeply nested table lacking a `run` key.","commonSituations":"Typos in mise.toml/config.toml hook definitions; hand-editing hooks and accidentally quoting or unquoting values; YAML-to-TOML conversion tools emitting non-string scalars; forgetting the `run` key inside a hook table.","solutions":["Change the hook value to a plain string, e.g. run = \"echo hi\"","Use an array of strings for multiple commands, e.g. run = [\"cmd1\", \"cmd2\"]","If using a table form, ensure it has a `run` key whose value is a string or string array","Validate the TOML file syntax and types with a TOML linter before loading"],"exampleFix":"# before\n[settings.hooks.postinstall]\nrun = 42\n# after\n[settings.hooks.postinstall]\nrun = \"echo postinstall\"","handlingStrategy":"validation","validationCode":"# pre-check a hook value before writing/committing TOML\nimport toml\nv = cfg[\"settings\"][\"hooks\"][\"postinstall\"][\"run\"]\nassert isinstance(v, str) or (isinstance(v, list) and all(isinstance(x, str) for x in v)), \"run must be string or string[]\"","typeGuard":"function isHookRun(v) { return typeof v === 'string' || (Array.isArray(v) && v.every(x => typeof x === 'string')); }","tryCatchPattern":null,"preventionTips":["Always define hooks as strings or arrays of strings","Use a TOML schema validator/JSON schema for config files in CI","Never put bare numbers or booleans in command lists"],"tags":["config","toml","validation"],"backgroundTag":"schema-validation-failed","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"}