{"record":{"id":"0e256cc1d36d1d34","repo":"wezterm/wezterm","slug":"invalid-wezterm-ssh-backend-value-expected-ei","errorCode":null,"errorMessage":"invalid wezterm_ssh_backend value: {}, expected either `ssh2` or `libssh`","messagePattern":"invalid wezterm_ssh_backend value: (.+?), expected either `ssh2` or `libssh`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wezterm-ssh/src/sessioninner.rs","lineNumber":102,"sourceCode":"            #[cfg(feature = \"ssh2\")]\n            \"ssh2\" => self.run_impl_ssh2(),\n\n            #[cfg(not(feature = \"ssh2\"))]\n            \"ssh2\" => anyhow::bail!(\n                \"invalid wezterm_ssh_backend value: {}, not compiled with `ssh2`\",\n                backend\n            ),\n\n            #[cfg(feature = \"libssh-rs\")]\n            \"libssh\" => self.run_impl_libssh(),\n\n            #[cfg(not(feature = \"libssh-rs\"))]\n            \"libssh\" => anyhow::bail!(\n                \"invalid wezterm_ssh_backend value: {}, not compiled with `libssh`\",\n                backend\n            ),\n\n            _ => anyhow::bail!(\n                \"invalid wezterm_ssh_backend value: {}, expected either `ssh2` or `libssh`\",\n                backend\n            ),\n        }\n    }\n\n    #[cfg(feature = \"libssh-rs\")]\n    fn run_impl_libssh(&mut self) -> anyhow::Result<()> {\n        let hostname = self\n            .config\n            .get(\"hostname\")\n            .ok_or_else(|| anyhow!(\"hostname not present in config\"))?\n            .to_string();\n        let user = self\n            .config\n            .get(\"user\")\n            .ok_or_else(|| anyhow!(\"username not present in config\"))?\n            .to_string();","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/wezterm/wezterm/blob/3ff7522b9617ec920f7fbdb22b57e93d42d93ee9/wezterm-ssh/src/sessioninner.rs#L84-L120","documentation":"The catch-all arm of backend dispatch: the wezterm_ssh_backend value in the SSH domain config matched neither 'ssh2' nor 'libssh' (case-sensitive), so run_impl bails before any connection is attempted. Both arms being compiled in means the value is simply unrecognized.","triggerScenarios":"Any wezterm_ssh_backend value other than the exact strings 'ssh2' or 'libssh' — typos like 'libssh2', 'SSH2', 'ssh 2', 'libssh-rs', or an accidental non-string Lua value that serializes differently.","commonSituations":"Hand-written config typos; confusion between the lib name 'libssh-rs' and the accepted value 'libssh'; copy-paste from outdated docs.","solutions":["Correct the value to exactly 'ssh2' or 'libssh' (lowercase)","Remove the key entirely to use the build's default backend","Double-check for stray whitespace or capitalization in the Lua string"],"exampleFix":"-- before\nwezterm_ssh_backend = 'libssh-rs',\n\n-- after\nwezterm_ssh_backend = 'libssh',","handlingStrategy":"type-guard","validationCode":"-- Lua: guard the backend string before building the domain\nlocal function valid_backend(b)\n  return b == nil or b == 'ssh2' or b == 'libssh'\nend\nassert(valid_backend(backend), \"wezterm_ssh_backend must be 'ssh2' or 'libssh'\")","typeGuard":"-- Lua\nlocal function is_valid_ssh_backend(v)\n  return type(v) == 'string' and (v == 'ssh2' or v == 'libssh')\nend","tryCatchPattern":null,"preventionTips":["Use exact lowercase strings; there are only two legal values","Centralize backend selection in one variable so typos fail a single assertion"],"tags":["wezterm","ssh","config","typo"],"backgroundTag":"invalid-config-value","analyzedSha":"3ff7522b9617ec920f7fbdb22b57e93d42d93ee9","analyzedAt":"2026-08-20T04:47:31.434Z","contentChangedAt":"2026-08-20T04:47:31.434Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}