rust-lang/cargo · error

error: Key has been revoked for

Error message

error: Key has been revoked for `{hostname}`
**************************************
* WARNING: REVOKED HOST KEY DETECTED *
**************************************
This may indicate that the key provided by this host has been compromised and should not be accepted.

The host key {key_type_short_name} {remote_host_key} is revoked
in {location} and has been rejected.

What it means

Error "error: Key has been revoked for `{hostname}` ************************************** * WARNING: REVOKED HOST KEY DETECTED * ************************************** This may indicate that the key provided by this host has been compromised and should not be accepted. The host key {key_type_short_name} {remote_host_key} is revoked in {location} and has been rejected. " thrown in rust-lang/cargo.

When it happens

Trigger: Thrown at src/sources/git/known_hosts.rs:298 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rust-lang/cargo@eb98b54bc9 (2026-08-11). Data as JSON: /api/errors/913f5d094482ae89. Report an issue: GitHub.

Appendix: source

Thrown at src/sources/git/known_hosts.rs:298

                resolve this error by {old_key_resolution}\n\
                \n\
                The key provided by the remote host is:\n\
                \n\
                {hostname} {key_type_name} {remote_host_key}\n\
                \n\
                See https://doc.rust-lang.org/stable/cargo/appendix/git-authentication.html#ssh-known-hosts \
                for more information.\n\
                "
            )
        }
        Err(KnownHostError::HostKeyRevoked {
            hostname,
            key_type,
            remote_host_key,
            location,
        }) => {
            let key_type_short_name = key_type.short_name();
            anyhow::bail!(
                "error: Key has been revoked for `{hostname}`\n\
                **************************************\n\
                * WARNING: REVOKED HOST KEY DETECTED *\n\
                **************************************\n\
                This may indicate that the key provided by this host has been\n\
                compromised and should not be accepted.
                \n\
                The host key {key_type_short_name} {remote_host_key} is revoked\n\
                in {location} and has been rejected.\n\
                "
            )
        }
        Err(KnownHostError::HostHasOnlyCertAuthority { hostname, location }) => {
            anyhow::bail!("error: Found a `@cert-authority` marker for `{hostname}`\n\
                \n\
                Cargo doesn't support certificate authorities for host key verification. It is\n\
                recommended that the command line Git client is used instead. This can be achieved\n\
                by setting `net.git-fetch-with-cli` to `true` in the Cargo config.\n\

View on GitHub (pinned to eb98b54bc9)