DioxusLabs/dioxus · error

Failed to convert {key:?} to tao::keyboard::KeyCode, try usi

Error message

Failed to convert {key:?} to tao::keyboard::KeyCode, try using tao::keyboard::KeyCode directly

What it means

The shortcut key conversion match fell through: the given dioxus_html::KeyCode has no mapping to a tao::keyboard::Code. The match arms cover a fixed set of keys, so an unmapped or newly added KeyCode variant reaches the fallback panic in into_key_code.

Source

Thrown at packages/desktop/src/shortcut.rs:300

            dioxus_html::KeyCode::F7 => Code::F7,
            dioxus_html::KeyCode::F8 => Code::F8,
            dioxus_html::KeyCode::F9 => Code::F9,
            dioxus_html::KeyCode::F10 => Code::F10,
            dioxus_html::KeyCode::F11 => Code::F11,
            dioxus_html::KeyCode::F12 => Code::F12,
            dioxus_html::KeyCode::NumLock => Code::NumLock,
            dioxus_html::KeyCode::ScrollLock => Code::ScrollLock,
            dioxus_html::KeyCode::Semicolon => Code::Semicolon,
            dioxus_html::KeyCode::EqualSign => Code::Equal,
            dioxus_html::KeyCode::Comma => Code::Comma,
            dioxus_html::KeyCode::Period => Code::Period,
            dioxus_html::KeyCode::ForwardSlash => Code::Slash,
            dioxus_html::KeyCode::GraveAccent => Code::Backquote,
            dioxus_html::KeyCode::OpenBracket => Code::BracketLeft,
            dioxus_html::KeyCode::BackSlash => Code::Backslash,
            dioxus_html::KeyCode::CloseBracket => Code::BracketRight,
            dioxus_html::KeyCode::SingleQuote => Code::Quote,
            key => panic!(
                "Failed to convert {key:?} to tao::keyboard::KeyCode, try using tao::keyboard::KeyCode directly"
            ),
        }
    }
}

View on GitHub (pinned to 24f6a829df)

Solutions

  1. This key cannot be converted automatically. Use tao::keyboard::KeyCode directly in the shortcut definition.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/desktop/src/shortcut.rs:300 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/c68011a1bed64b06. Report an issue: GitHub.