{"record":{"id":"bc47690fc75be4f2","repo":"wasmerio/wasmer","slug":"invalid-client-config-unknown-config-version-ve","errorCode":null,"errorMessage":"Invalid client config: unknown config version '{version}'","messagePattern":"Invalid client config: unknown config version '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/cli/src/edge_config.rs","lineNumber":38,"sourceCode":"\n    /// Token used for network access.\n    pub network_token: Option<String>,\n}\n\nimpl EdgeConfig {\n    pub const VERSION: u32 = 1;\n\n    pub fn from_slice(data: &[u8]) -> Result<Self, anyhow::Error> {\n        let data_str = std::str::from_utf8(data)?;\n        let value: toml::Value = toml::from_str(data_str).context(\"failed to parse config TOML\")?;\n\n        let version = value\n            .get(\"version\")\n            .and_then(|v| v.as_integer())\n            .context(\"invalid client config: no 'version' key found\")?;\n\n        if version != Self::VERSION as i64 {\n            bail!(\"Invalid client config: unknown config version '{version}'\");\n        }\n\n        let config = toml::from_str(data_str)?;\n        Ok(config)\n    }\n\n    /// Get a valid SSH token.\n    ///\n    /// Will filter out the stored token if it has expired.\n    pub fn get_valid_ssh_token(&self, app_id: Option<&str>) -> Option<&str> {\n        #[allow(clippy::manual_filter)]\n        if let Some(app_id) = app_id {\n            let token = self.ssh_app_tokens.get(app_id)?;\n            if jwt_token_valid(token) {\n                Some(token)\n            } else {\n                None\n            }","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/edge_config.rs#L20-L56","documentation":"`EdgeConfig::from_slice` parses a client edge config (TOML) and first requires a `version` key whose integer value matches the struct's current VERSION constant. If the version differs — config written by an older or newer client, or hand-edited — parsing is refused so fields are never misinterpreted across incompatible schemas. This is an explicit schema-compatibility guard.","triggerScenarios":"Loading an edge config file whose top-level `version` integer != Self::VERSION (e.g. a config generated by an older wasmer release), or a config missing the `version` key entirely (that path raises the related \"no 'version' key found\" context error).","commonSituations":"Upgrading or downgrading the wasmer CLI so the on-disk config format changed; manually editing ~/.wasmer edge config and altering/removing the version field; copying a config from a different deployment.","solutions":["Regenerate the config with the installed CLI version (e.g. re-run `wasmer login` / the command that writes the edge config)","Inspect the file and set `version = <N>` to the value expected by your CLI (check `EdgeConfig::VERSION` in lib/cli/src/edge_config.rs)","Upgrade or downgrade the wasmer CLI to the version that wrote the config, then migrate","Back up and delete the stale config file so the CLI recreates it"],"exampleFix":"// before (edge config)\nversion = 1\n\n// after (matching EdgeConfig::VERSION = 2)\nversion = 2","handlingStrategy":"validation","validationCode":"let raw = std::fs::read_to_string(path)?;\nlet v: toml::Value = raw.parse()?;\nmatch v.get(\"version\").and_then(|x| x.as_integer()) {\n    Some(ver) if ver == EXPECTED_VERSION => {},\n    Some(ver) => eprintln!(\"config version {ver} != expected {EXPECTED_VERSION}; regenerate config\"),\n    None => eprintln!(\"config missing 'version' key\"),\n}","typeGuard":"fn has_valid_version(v: &toml::Value, expected: i64) -> bool {\n    v.get(\"version\").and_then(|x| x.as_integer()) == Some(expected)\n}","tryCatchPattern":"match EdgeConfig::from_slice(&data) {\n    Ok(cfg) => cfg,\n    Err(e) if e.to_string().contains(\"unknown config version\") => {\n        eprintln!(\"Config written by a different wasmer version — regenerate it\");\n        return Err(e);\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Regenerate edge configs after upgrading/downgrading the wasmer CLI","Never hand-edit the `version` field in config files","Keep the CLI version in sync across machines sharing config files","Back up configs and let the CLI recreate them on version mismatch"],"tags":["config","schema-version","deserialization","cli"],"backgroundTag":"config-version-mismatch","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}