Skip to content

Search index failure when building docs #13702

Open
@tybug

Description

@tybug

Describe the bug

Hi! While updating dependencies in HypothesisWorks/hypothesis#4388, I saw a failure when running sphinx-build that only occurred when snowballstemmer was upgraded from 2.2.0 to 3.0.1:

Traceback (most recent call last):
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/cmd/build.py", line 514, in build_main
    app.build(args.force_all, args.filenames)
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/application.py", line 381, in build
    self.builder.build_update()
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 358, in build_update
    self.build(
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 440, in build
    self.finish()
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 676, in finish
    self.handle_finish()
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1226, in handle_finish
    self.finish_tasks.add_task(self.dump_search_index)
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/util/parallel.py", line 42, in add_task
    res = task_func()
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1248, in dump_search_index
    os.replace(searchindexfn + '.tmp', searchindexfn)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/hypothesis/hypothesis/hypothesis-python/docs/_build/html/searchindex.js.tmp' -> '/home/runner/work/hypothesis/hypothesis/hypothesis-python/docs/_build/html/searchindex.js'

Exception occurred:
  File "/tmp/.hypothesis-runtimes/virtualenvs/build-be25cfe95d/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1248, in dump_search_index
    os.replace(searchindexfn + '.tmp', searchindexfn)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/hypothesis/hypothesis/hypothesis-python/docs/_build/html/searchindex.js.tmp' -> '/home/runner/work/hypothesis/hypothesis/hypothesis-python/docs/_build/html/searchindex.js'
The full traceback has been saved in /tmp/sphinx-err-g_dct8cm.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

The originating sphinx command in the hypothesis tooling is:

def build_docs(*, builder="html", only=()):
    # See https://www.sphinx-doc.org/en/stable/man/sphinx-build.html
    tools.scripts.pip_tool(
        "sphinx-build",
        "--fail-on-warning",
        "--show-traceback",
        "--fresh-env",
        "--builder",
        builder,
        "docs",
        "docs/_build/" + builder,
        *only,
        cwd=HYPOTHESIS_PYTHON,
    )

The error only seems to occur about half the time, and I can't reproduce it locally (on macos).

I've pinned snowballstemmer to 2.2.0 for now to avoid this.

I know this isn't the most reproducible bug report, but I hope the knowledge about the version bump is enough to narrow down the cause!

How to Reproduce

.

Environment Information

sphinx==8.1.3
jinja2==3.1.6
docutils==0.21.2
pygments==2.18.0

Sphinx extensions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions