Runtime ErrorAll platformsStreamlit 1.x

MarshallComponentException: argument needs a label

pip install streamlit-js-eval
from streamlit_js_eval import streamlit_js_eval
result = streamlit_js_eval(js_expressions="navigator.userAgent")
MarshallComponentException: argument needs a label
streamlit_js_eval/frontend/build/static/js/main.chunk.js

Streamlit requires every custom component call to have a unique key argument so it can track component state across reruns. streamlit_js_eval raises MarshallComponentException when key is omitted because Streamlit cannot marshall the component return value without an identifier.

Any · Streamlit 1.x · no key
no key · failskey= · ok

1Always pass a unique key argumentEasiest

Add key= to every streamlit_js_eval call. Each call on the same page must have a different key string.

from streamlit_js_eval import streamlit_js_eval

# Get user agent
user_agent = streamlit_js_eval(
    js_expressions="navigator.userAgent",
    key="get_user_agent"
)

# Get screen width (different key)
screen_width = streamlit_js_eval(
    js_expressions="screen.width",
    key="get_screen_width"
)

streamlit-js-eval · Compatibility Matrix
See install results across all Python versions and operating systems
→
Observed in 61 searches · Last verified Aug 2026
MarshallComponentException: argument needs a label — streamlit-js-eval