{"record":{"id":"3a6bfe0f52bebb34","repo":"rust-lang/cargo","slug":"error-unknown-ssh-host-key-the-ssh-host-key-for","errorCode":null,"errorMessage":"error: unknown SSH host key\nThe SSH host key for `{hostname}` is not known and cannot be validated.\n\nTo resolve this issue, add the host key to {known_hosts_location}\n\nThe key to add is:\n\n{hostname} {key_type_name} {remote_host_key}\n\nThe {key_type_short_name} key fingerprint is: SHA256:{remote_fingerprint}\nThis fingerprint should be validated with the server administrator that it is correct.\n{other_hosts_message}\nSee https://doc.rust-lang.org/stable/cargo/appendix/git-authentication.html#ssh-known-hosts for more information.\n","messagePattern":"error: unknown SSH host key\nThe SSH host key for `(.+?)` is not known and cannot be validated\\.\n\nTo resolve this issue, add the host key to (.+?)\n\nThe key to add is:\n\n(.+?) (.+?) (.+?)\n\nThe (.+?) key fingerprint is: SHA256:(.+?)\nThis fingerprint should be validated with the server administrator that it is correct\\.\n(.+?)\nSee https://doc\\.rust-lang\\.org/stable/cargo/appendix/git-authentication\\.html#ssh-known-hosts for more information\\.\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sources/git/known_hosts.rs","lineNumber":213,"sourceCode":"            let other_hosts_message = if other_hosts.is_empty() {\n                String::new()\n            } else {\n                let mut msg = String::from(\n                    \"Note: This host key was found, \\\n                    but is associated with a different host:\\n\",\n                );\n                for known_host in other_hosts {\n                    write!(\n                        msg,\n                        \"    {loc}: {patterns}\\n\",\n                        loc = known_host.location,\n                        patterns = known_host.patterns\n                    )\n                    .unwrap();\n                }\n                msg\n            };\n            anyhow::bail!(\n                \"error: unknown SSH host key\\n\\\n                The SSH host key for `{hostname}` is not known and cannot be validated.\\n\\\n                \\n\\\n                To resolve this issue, add the host key to {known_hosts_location}\\n\\\n                \\n\\\n                The key to add is:\\n\\\n                \\n\\\n                {hostname} {key_type_name} {remote_host_key}\\n\\\n                \\n\\\n                The {key_type_short_name} key fingerprint is: SHA256:{remote_fingerprint}\\n\\\n                This fingerprint should be validated with the server administrator that it is correct.\\n\\\n                {other_hosts_message}\\n\\\n                See https://doc.rust-lang.org/stable/cargo/appendix/git-authentication.html#ssh-known-hosts \\\n                for more information.\\n\\\n                \"\n            )\n        }\n        Err(KnownHostError::HostKeyHasChanged {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/rust-lang/cargo/blob/eb98b54bc9f3c74519f43d066cb3fd02ebc88df0/src/sources/git/known_hosts.rs#L195-L231","documentation":"Error \"error: unknown SSH host key\nThe SSH host key for `{hostname}` is not known and cannot be validated.\n\nTo resolve this issue, add the host key to {known_hosts_location}\n\nThe key to add is:\n\n{hostname} {key_type_name} {remote_host_key}\n\nThe {key_type_short_name} key fingerprint is: SHA256:{remote_fingerprint}\nThis fingerprint should be validated with the server administrator that it is correct.\n{other_hosts_message}\nSee https://doc.rust-lang.org/stable/cargo/appendix/git-authentication.html#ssh-known-hosts for more information.\n\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/sources/git/known_hosts.rs:213 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eb98b54bc9f3c74519f43d066cb3fd02ebc88df0","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}