-
Notifications
You must be signed in to change notification settings - Fork 95
Cryptic error message when override file path does not exist #475
Description
Context
Suppose in the theme section you specify a custom_dir path which doesn’t actually exist. I was using a mkdocs.yml file for configuration that was copied from a previous project to a new project for which I wanted to use Zensical. And when updating the old file for the new project I forgot to delete the custom_dir option within the theme section so it pointed to a non-existent path.
Previously with MkDocs with the Material Theme I got a very descriptive error message similar to:
ERROR - Config value 'theme': The path set in custom_dir ('/home/user/src/project/docs/overrides') does not exist.Now in Zensical I get a very cryptic error message which is not helpful along the lines of:
thread '<unnamed>' (786354) panicked at crates/zensical/src/config.rs:114:49:
invariant: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/home/user/src/project/.venv/bin/zensical", line 10, in <module>
sys.exit(cli())
~~~^^
File "/home/user/src/project/.venv/lib/python3.14/site-packages/click/core.py", line 1485, in __call__
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/user/src/project/.venv/lib/python3.14/site-packages/click/core.py", line 1406, in main
rv = self.invoke(ctx)
File "/home/user/src/project/.venv/lib/python3.14/site-packages/click/core.py", line 1873, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/user/src/project/.venv/lib/python3.14/site-packages/click/core.py", line 1269, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/src/project/.venv/lib/python3.14/site-packages/click/core.py", line 824, in invoke
return callback(*args, **kwargs)
File "/home/user/src/project/.venv/lib/python3.14/site-packages/zensical/main.py", line 83, in execute_build
build(os.path.abspath(config_file), kwargs.get("clean", False))
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: invariant: Os { code: 2, kind: NotFound, message: "No such file or directory" }Bug description
If the custom_dir path doesn't exist, there error message is cryptic. I know some path doesn't exist, but I have no idea which one.
Related links
Reproduction
Create a brand new Zensical project, add a custom_dir setting with a non-existent file system path.
Steps to reproduce
- Create new Zensical project
- Edit configuration file to add
custom_dirand set it to a path that doesn't exist - Build documentation
Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction.