Skip to content

Conversation

@humitos
Copy link
Member

@humitos humitos commented Oct 13, 2025

Follow up from user contributed PR at #12378

This implementation follows the same idea that we have implemented in Sphinx:

  • if mkdocs.configuration YAML key is missing, we show: MkDocs configuration file is missing
  • if the file declared in mkdocs.configuration doesn't exist, we show: Expected file not found (with the path)
Screenshot_2025-10-28_11-57-09 Screenshot_2025-10-28_11-57-03

Closes #11937
Closes #12378

RabbitAlbatross and others added 8 commits August 4, 2025 21:49
Sorry for being so late.
added MKDOCS_NOT_FOUND constant to ProjectConfigurationError
added MkDocs notification for missing mkdocs.yml
raise MKDOCS_NOT_FOUND when mkdocs.yml is missing
@read-the-docs-community
Copy link

read-the-docs-community bot commented Oct 13, 2025

Documentation build overview

📚 dev | 🛠️ Build #30212270 | 📁 Comparing 2f31863 against latest (58e1c2a)


🔍 Preview build

Show files changed (7 files in total): 📝 7 modified | ➕ 0 added | ➖ 0 deleted
File Status
aws-temporary-credentials.html 📝 modified
contribute.html 📝 modified
github-app.html 📝 modified
design/build-images.html 📝 modified
design/future-builder.html 📝 modified
design/new-notifications-system.html 📝 modified
design/secure-api-access-from-builders.html 📝 modified

@read-the-docs-community
Copy link

read-the-docs-community bot commented Oct 13, 2025

Documentation build overview

📚 docs | 🛠️ Build #30212271 | 📁 Comparing 2f31863 against latest (58e1c2a)


🔍 Preview build

Show files changed (11 files in total): 📝 11 modified | ➕ 0 added | ➖ 0 deleted
File Status
science.html 📝 modified
security-implications.html 📝 modified
security.html 📝 modified
commercial/sharing.html 📝 modified
guides/build-troubleshooting.html 📝 modified
guides/connecting-git-account.html 📝 modified
guides/creating-project-private-repository.html 📝 modified
guides/deprecating-content.html 📝 modified
guides/technical-docs-seo-guide.html 📝 modified
tutorial/index.html 📝 modified
guides/best-practice/links.html 📝 modified

@humitos humitos changed the title fix(build): raise clear error if mkdocs.yml config file is missing Raise clear error when mkdocs.yml config file is missing Oct 13, 2025
@humitos humitos marked this pull request as ready for review October 13, 2025 10:24
@humitos humitos requested a review from a team as a code owner October 13, 2025 10:24
@humitos humitos requested a review from stsewd October 13, 2025 10:24
Comment on lines -56 to -58
# TODO: we should eventually remove this method completely and stop
# relying on "loading the `mkdocs.yml` file in a safe way just to know
# if it's a MKDOCS or MKDOCS_HTML documentation type".
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are relying on self.config.doctype now which always return mkdocs.

@humitos humitos requested a review from stsewd November 5, 2025 15:39
@humitos
Copy link
Member Author

humitos commented Nov 26, 2025

@copilot make a test case for this PR

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@humitos I've opened a new pull request, #12607, to work on those changes. Once the pull request is ready, I'll request review from you.

MkDocs builds failed with unclear errors when the configuration file was
missing. This aligns MkDocs error handling with the existing Sphinx
implementation.

### Changes

- **Error messaging**: When `mkdocs.configuration` is declared but the
file doesn't exist, raises `UserFileNotFound` with the path
- **Test coverage**: Added
`MkDocsBuilderTest.test_project_without_mkdocs_yml` to verify the error
behavior

### Error Examples

Missing `mkdocs.configuration` key:
![MkDocs configuration file is
missing](https://github.com/user-attachments/assets/e6409f0f-d23a-413f-90ae-80e672994a98)

Declared file doesn't exist:
![Expected file not
found](https://github.com/user-attachments/assets/41244494-e276-4a39-ad9c-7753207a7622)

Closes #11937
Closes #12378

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: humitos <244656+humitos@users.noreply.github.com>
@humitos humitos enabled auto-merge (squash) November 26, 2025 11:54
@humitos humitos merged commit f495190 into main Nov 26, 2025
8 checks passed
@humitos humitos deleted the humitos/followup-12378 branch November 26, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build: "Unknown" error when mkdocs.yml is not found

4 participants