Just created a new streamlit app (1.45.1). The file tree is as follows:
├── .gitignore
├── .python-version
├── README.md
├── another-page.py
├── main.py
├── pyproject.toml
└── uv.lock
contents of main.py:
import streamlit as st
def main():
st.page_link("another-page.py")
if __name__ == "__main__":
main()
contents of another-page.py:
import streamlit as st
st.title("Another Page", label="another page")
When I streamlit run main.py
, this error pops up:
2025-05-28 18:07:00.697 Uncaught app execution
Traceback (most recent call last):
File "/streamlit-test/.venv/lib/python3.13/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 121, in exec_func_with_error_handling
result = func()
File "streamlit-test/.venv/lib/python3.13/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 645, in code_to_exec
exec(code, module.__dict__)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "streamlit-test/main.py", line 7, in <module>
main()
~~~~^^
File "streamlit-test/main.py", line 4, in main
st.page_link("another-page.py")
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "streamlit-test/.venv/lib/python3.13/site-packages/streamlit/runtime/metrics_util.py", line 444, in wrapped_func
result = non_optional_func(*args, **kwargs)
File "streamlit-test/.venv/lib/python3.13/site-packages/streamlit/elements/widgets/button.py", line 773, in page_link
return self._page_link(
~~~~~~~~~~~~~~~^
page=page,
^^^^^^^^^^
...<4 lines>...
use_container_width=use_container_width,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "streamlit-test/.venv/lib/python3.13/site-packages/streamlit/elements/widgets/button.py", line 961, in _page_link
url_pathname = page_data["url_pathname"]
~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'url_pathname'
There’s no clear error message and I can’t find anything in the docs for this. Could this be a bug?