readthedocs.org: Sphinx error: master file [..]/checkouts/latest/contents.rst not found

I’m still new to readthedocs.org and have no experience with either Python nor Sphinx, please excuse me if I’m doing something obviously wrong. I googled the error and have found other builds failing with the same error, but when I looked at their commits that lead to a successful build, the changes didn’t make sense to me.

Details

Expected Result

I expected a new version of docs to be built at http://hoodie-test.readthedocs.io/en/latest/

Actual Result

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 244, in main
    app.build(opts.force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 266, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 251, in build_update
    'out of date' % len(to_build))
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 265, in build
    self.doctreedir, self.app))
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/environment.py", line 622, in update
    self.doc2path(config.master_doc))
SphinxError: master file /home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/checkouts/latest/contents.rst not found

Sphinx error:
master file /home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/checkouts/latest/contents.rst not found

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 23
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Encountered the same problem here.

I’m using sphinx 2.0.1. The generated structure by sphinx-quickstart command is built into html documentation successfully in my environment, while in readthedocs.org there occurs “contents.rst not found” error.

I finally found it works by adding the following line in conf.py to explicitly assign the master document:

master_doc = 'index'

I guess this issue is caused by the conflicts of the default sphinx version in readthedocs and the local environment.

I just record this solution here in case someone like me will be confused by this issue and have no idea about how to deal with it.

This doesn’t look to be a problem with RTD, so I’m going to close it. The error message states it is looking for a contents.rst, which doesn’t exist. If you don’t specify otherwise, Sphinx’s default master_doc setting is contents. If you’d like to use index instead, you’ll need to create a configuration file. I suggest you first explore http://www.sphinx-doc.org/en/1.5.1/tutorial.html as you should be getting the same errors locally, it might be easier to learn Sphinx this way.

Encountered the same problem here.

I’m using sphinx 2.0.1. The generated structure by sphinx-quickstart command is built into html documentation successfully in my environment, while in readthedocs.org there occurs “contents.rst not found” error.

I finally found it works by adding the following line in conf.py to explicitly assign the master document:

master_doc = 'index'

I guess this issue is caused by the conflicts of the default sphinx version in readthedocs and the local environment.

I just record this solution here in case someone like me will be confused by this issue and have no idea about how to deal with it.

Worked for me !! Thanks

You can use a requirements.txt file to use the same version of sphinx you use locally https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html

You can use a requirements.txt file to use the same version of sphinx you use locally https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html

Currently, RTD installs the following packages before installing packages from the project requirements file:

python -m pip install --upgrade --cache-dir .cache/pip Pygments==2.3.1 setuptools==41.0.1 docutils==0.14 mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<1.1 

I do not know why they use such old versions (sphinx<2 for example). If I do not set versions in my requirement file, sphinx version will not be updated and I will get the error contents.rst not found. In my opinion, it seems stupid.

I think self-hosted deployments have to define the feature flag default themselves in order to avoid this issue?

Yeah, that’s correct. You can set the default_true and future_default_true atributes to True so it’s aplied to all projects, old and future ones.

btw, we already install the latest sphinx version for new projects (created after Oct 20, 2020)