Skip to content

Missing build directory leads to builder-inited error #235

Closed

Description

@Helveg

Describe the bug

When I use Sphinx >= 8.1 and sphinx-design 0.6 on Windows, and sphinx-design is the first extension to use the static path, the following error occurs with sphinx-build -v -b html . _build/iso-html

Traceback (most recent call last):
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\events.py", line 404, in emit
    results.append(listener.handler(self.app, *args))
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx_design\extension.py", line 86, in update_css_js
    static_path.mkdir(exist_ok=True)
  File "C:\Users\robin\AppData\Roaming\uv\python\cpython-3.10.12-windows-x86_64-none\lib\pathlib.py", line 1175, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\cmd\build.py", line 496, in build_main
    app = Sphinx(
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\application.py", line 295, in __init__
    self._init_builder()
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\application.py", line 369, in _init_builder
    self.events.emit('builder-inited')
  File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\events.py", line 415, in emit
    raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function update_css_js at 0x0000019B5B241E10> for event 'builder-inited' threw an exception (exception: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static')
Extension error (sphinx_design.extension):
Handler <function update_css_js at 0x0000019B5B241E10> for event 'builder-inited' threw an exception (exception: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static')

Adding parents=True to the mkdir call solves the problem. I'm not sure if it's the correct solution, perhaps there's an underlying issue that causes the build directory to be absent? The Sphinx build continues correctly after that.

If the build directory existed from the previous build (even though it should have been rm'ed by rimraf) the error also does not occur. So as far as I can tell there seems to be a problem with my filesystem/Sphinx/... and the _build/iso-html build directory is behaving weirdly.

Reproduce the bug

  1. Use sphinx>=8.1, sphinx-design~=0.6
  2. Add it as only extension
  3. Run sphinx-build -b html . _build/iso-html on Windows

List your environment

No response

Activity

  1. added
    bug
    on May 3, 2025
  2. added a commit that references this issue on May 3, 2025
    981c4d6
  3. Helveg commented on May 3, 2025

    @Helveg
    Author

    I found the underlying problem! This occurs when you forget to add sphinx_design to your extensions list in conf.py, what surprises me is that any sphinx-design code is running at all in my sphinx build then?

    What to do here then, maybe raise a more informative error? I'll close my PR #236 then because that would silence this problem.

  4. added a commit that references this issue on Aug 4, 2026
    1bfd79d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions