{"record":{"id":"94e8faf13e30d065","repo":"wasmerio/wasmer","slug":"invalid-value-for-expected-0-false-1-true","errorCode":null,"errorMessage":"invalid value for {} - expected 0/false|1/true: '{other}'","messagePattern":"invalid value for (.+?) - expected 0/false\\|1/true: '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/backend-api/src/client.rs","lineNumber":65,"sourceCode":"        user_agent\n            .parse()\n            .with_context(|| format!(\"invalid user agent: '{user_agent}'\"))\n    }\n\n    pub fn new_with_client(\n        client: reqwest::Client,\n        graphql_endpoint: Url,\n        user_agent: &str,\n    ) -> Result<Self, anyhow::Error> {\n        let log_variables = {\n            let v = std::env::var(Self::ENV_VAR_LOG_VARIABLES).unwrap_or_default();\n            match v.as_str() {\n                \"1\" | \"true\" => true,\n                \"0\" | \"false\" => false,\n                // Default case if not provided.\n                \"\" => false,\n                other => {\n                    bail!(\n                        \"invalid value for {} - expected 0/false|1/true: '{other}'\",\n                        Self::ENV_VAR_LOG_VARIABLES\n                    );\n                }\n            }\n        };\n\n        Ok(Self {\n            client,\n            auth_token: None,\n            user_agent: Self::parse_user_agent(user_agent)?,\n            graphql_endpoint,\n            log_variables,\n        })\n    }\n\n    pub fn new(graphql_endpoint: Url, user_agent: &str) -> Result<Self, anyhow::Error> {\n        Self::new_with_proxy(graphql_endpoint, user_agent, None)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/backend-api/src/client.rs#L47-L83","documentation":"WasmerClient::new_with_client parses the env var WASMER_LOG_VARIABLES (Self::ENV_VAR_LOG_VARIABLES) as a boolean flag. Only \"1\", \"true\", \"0\", \"false\", or empty are accepted; any other value causes a bail with this message naming the env var and offending value.","triggerScenarios":"Setting the log-variables environment variable to anything other than 0/1/true/false/empty — e.g. WASMER_LOG_VARIABLES=yes, on, or True (capitalized) — before creating a WasmerClient.","commonSituations":"Users setting the toggle to \"yes\"/\"on\" out of habit, shell capitalization (\"True\"), or copy-pasting a value with stray whitespace.","solutions":["Set the env var to exactly \"1\", \"true\", \"0\", \"false\", or unset it entirely.","Normalize the value before launching: lowercase it and trim whitespace.","If you need richer toggle semantics, propose extending the parser to accept yes/no or case-insensitive true/false."],"exampleFix":"// before\nexport WASMER_LOG_VARIABLES=yes\n// after\nexport WASMER_LOG_VARIABLES=true","handlingStrategy":"validation","validationCode":"fn valid_bool_env(v: &str) -> bool {\n    matches!(v.trim().to_ascii_lowercase().as_str(), \"\" | \"0\" | \"1\" | \"true\" | \"false\")\n}\n// check before launching: valid_bool_env(&env::var(\"WASMER_LOG_VARIABLES\").unwrap_or_default())","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set WASMER_LOG_VARIABLES to 0/1/true/false","Normalize env values: trim and lowercase in wrapper scripts","Unset the variable instead of inventing values like yes/on"],"tags":["config","env-var","validation","backend-api"],"backgroundTag":"invalid-env-var-value","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}