Skip to content

KeyError on results_page if initiate quiz and come back to it after a short while #39

@Airofoil

Description

@Airofoil

Thanks for the fun app!

I initiated the quiz, completed the first page, then came back later to complete the rest of it (>20min), but upon completion, got the below error at the results page. I was able to restart the quiz from the start, and was able to complete it successfully and see my results, but upon refreshing the results page, the same below error appears:

KeyError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:

File "/mount/src/shelfside/main.py", line 30, in <module>
    pg.run()
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/navigation/page.py", line 300, in run
    exec(code, module.__dict__)  # noqa: S102
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mount/src/shelfside/personality-quiz/06_results_page.py", line 61, in <module>
    dictList = [st.session_state[f'page{i+1}_results'] for i in range(4)]
                ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/state/session_state_proxy.py", line 101, in __getitem__
    return get_session_state()[key]
           ~~~~~~~~~~~~~~~~~~~^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/state/safe_session_state.py", line 104, in __getitem__
    return self._state[key]
           ~~~~~~~~~~~^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/state/session_state.py", line 471, in __getitem__
    raise KeyError(_missing_key_error_message(key))```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions