{"record":{"id":"5871b6b29cf6ae13","repo":"jdx/mise","slug":"key-cannot-be-set-in-a-config-file-mise-reads-i","errorCode":null,"errorMessage":"{key} cannot be set in a config file: mise reads it before config files load. Use the {} environment variable instead.","messagePattern":"(.+?) cannot be set in a config file: mise reads it before config files load\\. Use the (.+?) environment variable instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/settings/set.rs","lineNumber":56,"sourceCode":"        }\n    }\n}\n\npub(super) fn set(mut key: &str, value: &str, add: bool, local: bool) -> Result<()> {\n    key = super::canonical_setting(key);\n    let meta = match SETTINGS_META.get(key) {\n        Some(meta) => meta,\n        None => {\n            bail!(\"Unknown setting: {}\", key);\n        }\n    };\n\n    // Writing it would succeed and then be ignored, and `mise settings get` would report the\n    // stored value as if it were live. See https://github.com/jdx/mise/discussions/5791.\n    // `mise settings unset` is deliberately still allowed, so anyone who already has one of\n    // these in a config can remove it.\n    if meta.env_only {\n        bail!(\n            \"{key} cannot be set in a config file: mise reads it before config files load. Use the {} environment variable instead.\",\n            meta.env.unwrap_or(\"matching MISE_*\")\n        );\n    }\n\n    let value = match meta.type_ {\n        SettingsType::Bool => parse_bool(value)?,\n        SettingsType::Integer => parse_i64(value)?,\n        SettingsType::Duration => parse_duration(value)?,\n        SettingsType::Url | SettingsType::Path | SettingsType::String => value.into(),\n        SettingsType::ListString => parse_list_by_comma(value)?,\n        SettingsType::ListPath => parse_list_by_os_path_separator(value)?,\n        SettingsType::SetString => parse_set_by_comma(value)?,\n        SettingsType::IndexMap => parse_indexmap_by_json(value)?,\n        SettingsType::BoolOrString => parse_bool(value).unwrap_or_else(|_| value.into()),\n    };\n\n    let path = if local {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/settings/set.rs#L38-L74","documentation":"Some settings are `env_only`: mise reads them from environment variables before any config file is parsed (bootstrap settings), so a value written into a config file would be stored but never honored — and `mise settings get` would misleadingly report it as live. mise therefore refuses to write such keys to a config file and points you at the corresponding MISE_* environment variable. `mise settings unset` is still allowed so existing entries can be removed.","triggerScenarios":"Running `mise settings set <env-only-key> <value>` (or the TOML equivalent) for a key whose meta.env_only is true — e.g. settings that control config loading itself, like CI or verbosity flags.","commonSituations":"Trying to persist `ci`, `quiet`, or similar bootstrap settings in mise.toml or settings.toml; scripting config setup and assuming all settings are file-writable.","solutions":["Export the matching environment variable instead, e.g. MISE_CI=1 (the error names the exact variable, or a matching MISE_* pattern).","Remove any existing config-file entry with `mise settings unset <key>`.","If persistence is needed, set the env var in your shell profile rather than a mise config file."],"exampleFix":"// before\nmise settings set ci true\n// ci cannot be set in a config file...\n\n// after\nexport MISE_CI=1   # in shell profile or CI environment","handlingStrategy":"validation","validationCode":"case \"$key\" in ci|quiet|debug|verbose|trace|log_level) echo \"$key is env-only: use MISE_* env var\" >&2;; esac","typeGuard":null,"tryCatchPattern":"mise settings set \"$key\" \"$value\" || export \"MISE_${key^^}=1\"","preventionTips":["Never put bootstrap-time settings in config files; use MISE_* env vars","Check the error message — it names the exact env var to use","Use `mise settings unset` to clean up pre-existing config-file entries"],"tags":["cli","settings","configuration","env-vars"],"backgroundTag":"conflicting-config-options","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"}