Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error of recent_files.toml #3668

Closed
niv-gv opened this issue Feb 3, 2025 · 0 comments · Fixed by #3671
Closed

Parsing error of recent_files.toml #3668

niv-gv opened this issue Feb 3, 2025 · 0 comments · Fixed by #3671
Labels
bug Something isn't working

Comments

@niv-gv
Copy link

niv-gv commented Feb 3, 2025

Describe the bug

I came across an error, where some marimo tools that I created were not running, due to a defected recent_files.toml file.
I'm not sure what caused the file to be bad, and already removed it, but I do know that the code around line 37 in marimo/_utils/config/config.py tries to parse this file and only handles FileNotFoundError - it does not handle parsing errors, and apparently they happen.

Thank you, and here's the traceback of this error:

File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/marimo/_server/api/endpoints/ws.py", line 441, in get_sessi>
Jan 31 17:12:30 crete run_mpmt.sh[1701]: new_session = mgr.create_session(
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/marimo/_server/sessions.py", line 729, in create_session
Jan 31 17:12:30 crete run_mpmt.sh[1701]: self.recents.touch(app_file_manager.path)
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/marimo/_server/recents.py", line 42, in touch
Jan 31 17:12:30 crete run_mpmt.sh[1701]: state = self.config.read_toml(
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/marimo/_utils/config/config.py", line 37, in read_toml
Jan 31 17:12:30 crete run_mpmt.sh[1701]: data = tomlkit.parse(file.read())
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/tomlkit/api.py", line 91, in parse
Jan 31 17:12:30 crete run_mpmt.sh[1701]: return Parser(string).parse()
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/tomlkit/parser.py", line 139, in parse
Jan 31 17:12:30 crete run_mpmt.sh[1701]: item = self._parse_item()
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/tomlkit/parser.py", line 238, in _parse_item
Jan 31 17:12:30 crete run_mpmt.sh[1701]: return self._parse_key_value(True)
Jan 31 17:12:30 crete run_mpmt.sh[1701]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 31 17:12:30 crete run_mpmt.sh[1701]: File "/home/gvmarimo/.cache/pypoetry/virtualenvs/ml-pipeline-ZP2dUw9--py3.12/lib/python3.12/site-packages/tomlkit/parser.py", line 323, in _parse_key_value
Jan 31 17:12:30 crete run_mpmt.sh[1701]: raise self.parse_error(UnexpectedCharError, self._current)
Jan 31 17:12:30 crete run_mpmt.sh[1701]: tomlkit.exceptions.UnexpectedCharError: Unexpected character: ',' at line 2 col 43

Environment

{
  "marimo": "0.9.3",
  "OS": "Linux",
  "OS Version": "6.12.10-200.fc41.x86_64",
  "Processor": "",
  "Python Version": "3.12.8",
  "Binaries": {
    "Browser": "--",
    "Node": "v22.11.0"
  },
  "Dependencies": {
    "click": "8.1.7",
    "importlib-resources": "missing",
    "jedi": "0.19.1",
    "markdown": "3.7",
    "pygments": "2.18.0",
    "pymdown-extensions": "10.9",
    "ruff": "0.6.3",
    "starlette": "0.38.4",
    "tomlkit": "0.13.2",
    "typing-extensions": "4.12.2",
    "uvicorn": "0.30.6",
    "websockets": "12.0"
  },
  "Optional Dependencies": {
    "altair": "5.4.1",
    "pandas": "2.1.4",
    "polars": "1.6.0",
    "pyarrow": "15.0.2"
  }
}

Code to reproduce

No response

@niv-gv niv-gv added the bug Something isn't working label Feb 3, 2025
devin-ai-integration bot added a commit that referenced this issue Feb 3, 2025
- Add error handling for tomlkit.exceptions.TOMLKitError
- Add tests for valid and invalid TOML parsing
- Fixes #3668

Co-Authored-By: Myles Scolnick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant