{"record":{"id":"b4ef5cb6d8eb3b49","repo":"emilk/egui","slug":"unsupported-value-for-update-snapshots-unknown","errorCode":null,"errorMessage":"Unsupported value for UPDATE_SNAPSHOTS: {unknown:?}","messagePattern":"Unsupported value for UPDATE_SNAPSHOTS: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/egui_kittest/src/snapshot.rs","lineNumber":400,"sourceCode":"#[derive(Clone, Copy, Debug, PartialEq, Eq)]\nenum Mode {\n    Test,\n    UpdateFailing,\n    UpdateAll,\n}\n\nimpl Mode {\n    fn from_env() -> Self {\n        let Ok(value) = std::env::var(\"UPDATE_SNAPSHOTS\") else {\n            return Self::Test;\n        };\n\n        match value.as_str() {\n            \"false\" | \"0\" | \"no\" | \"off\" => Self::Test,\n            \"true\" | \"1\" | \"yes\" | \"on\" => Self::UpdateFailing,\n            \"force\" => Self::UpdateAll,\n            unknown => {\n                panic!(\"Unsupported value for UPDATE_SNAPSHOTS: {unknown:?}\");\n            }\n        }\n    }\n\n    fn is_update(&self) -> bool {\n        match self {\n            Self::Test => false,\n            Self::UpdateFailing | Self::UpdateAll => true,\n        }\n    }\n}\n\n/// Image snapshot test with custom options.\n///\n/// If you want to change the default options for your whole project, it's recommended to create a\n/// new `my_image_snapshot` function in your project that calls this function with the desired options.\n/// You could additionally use the\n/// [disallowed_methods](https://rust-lang.github.io/rust-clippy/master/#disallowed_methods)","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/emilk/egui/blob/441971a776322a482e371775219380eca812cfa9/crates/egui_kittest/src/snapshot.rs#L382-L418","documentation":"The UPDATE_SNAPSHOTS environment variable controls snapshot behavior (Test, UpdateFailing, UpdateAll). SnapshotOptions::from_env parses known string values and panics on anything unrecognized, refusing to guess the developer's intent. Only \"false\"/\"0\"/\"no\"/\"off\", \"true\"/\"1\"/\"yes\"/\"on\", and \"force\" are accepted.","triggerScenarios":"Setting UPDATE_SNAPSHOTS to any string outside the accepted set — e.g. UPDATE_SNAPSHOTS=yes\\ (trailing whitespace), \"YES\" (case sensitivity), \"update\", \"all\", or \"True\" — before running kittest-based tests.","commonSituations":"Typo'd or case-mismatched env values in CI configuration; copying \"UPDATE_SNAPSHOTS=all\" from another snapshot library's docs; shell quoting errors introducing stray whitespace or quotes into the value.","solutions":["Set UPDATE_SNAPSHOTS to one of: false/0/no/off, true/1/yes/on, or force","Check for stray whitespace, quotes, or casing in your env var definition (echo \"$UPDATE_SNAPSHOTS\" | cat -A)","In CI, fix the workflow env block or command-line prefix to use an exact accepted value","Unset the variable entirely to use the default (Test) mode"],"exampleFix":"// before\nUPDATE_SNAPSHOTS=all cargo test\n// after\nUPDATE_SNAPSHOTS=force cargo test","handlingStrategy":"validation","validationCode":"const VALID: [&str; 12] = [\"false\",\"0\",\"no\",\"off\",\"true\",\"1\",\"yes\",\"on\",\"force\"];\nlet v = std::env::var(\"UPDATE_SNAPSHOTS\").unwrap_or_default();\nassert!(v.is_empty() || VALID.contains(&v.as_str()), \"UPDATE_SNAPSHOTS must be one of {VALID:?}, got {v:?}\");","typeGuard":null,"tryCatchPattern":"// from_env panics; validate the value in CI before cargo test\nmatch std::env::var(\"UPDATE_SNAPSHOTS\") {\n    Ok(v) if ![\"false\",\"0\",\"no\",\"off\",\"true\",\"1\",\"yes\",\"on\",\"force\"].contains(&v.as_str()) => {\n        panic!(\"fix UPDATE_SNAPSHOTS={v:?}: allowed values are false/0/no/off, true/1/yes/on, force\");\n    }\n    _ => {}\n}","preventionTips":["Use the exact lowercase accepted values in CI config and shell scripts","Quote env values carefully in shell to avoid trailing whitespace","Do not copy env var values from other snapshot-testing libraries","Add a CI lint step that validates UPDATE_SNAPSHOTS before running tests"],"tags":["rust","environment-variable","testing","snapshot","panic"],"backgroundTag":"invalid-env-var-value","analyzedSha":"441971a776322a482e371775219380eca812cfa9","analyzedAt":"2026-09-12T04:29:21.500Z","contentChangedAt":"2026-09-12T04:29:21.500Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}