streamlit/streamlit · error · StreamlitAPIException

shortcut must include a single character or one of the suppo

Error message

shortcut must include a single character or one of the supported keys (e.g. Enter, Space, Tab, Escape).

What it means

Error "shortcut must include a single character or one of the supported keys (e.g. Enter, Space, Tab, Escape)." thrown in streamlit/streamlit.

Source

Thrown at lib/streamlit/elements/lib/shortcut_utils.py:114

    }
)

_warned_browser_reserved_shortcuts: set[str] = set()


def _normalize_key_token(lower_token: str) -> str:
    """Normalize a key token to a format that can be used on the client side."""

    if lower_token in _KEY_ALIASES:
        return _KEY_ALIASES[lower_token]

    if len(lower_token) == 1 and lower_token.isalnum():
        return lower_token

    if lower_token.startswith("f") and lower_token[1:].isdigit():
        return lower_token

    raise StreamlitAPIException(
        "shortcut must include a single character or one of the supported keys "
        "(e.g. Enter, Space, Tab, Escape)."
    )


def normalize_shortcut(shortcut: str) -> str:
    """Normalize a shortcut string to a format that can be used on the client side.

    Parameters
    ----------
    shortcut : str
        The shortcut string to normalize.

    Returns
    -------
    str
        The normalized shortcut string.

View on GitHub (pinned to 202661fc55)

When it happens

Trigger: Thrown at lib/streamlit/elements/lib/shortcut_utils.py:114 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of streamlit/streamlit@202661fc55 (2026-08-26). Data as JSON: /api/errors/e7a0ce3e682eaea1. Report an issue: GitHub.