rust-lang / rust-lang/mdBook

Improve error when writing `mdbook serve` from nested folder

Open
#3,000 1 comment 0 reactions 1 assignee View on GitHub

@lquenti is already working on this.

Since Jan 3, 2026.

C-enhancement Command-serve
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

Problem

My girlfriend and I are using mdbook for our personal cookbook and it works great! She is non-technical, but I CI-automated the deployment so that once she pushes it automatically updates the deployment. The only issue is as follows:

  • She opens the folder in kate, starts the embedded terminal
  • Tries to mdbook something, with the help of mdbook --help
  • Sees mdbook serve, and gets the following error
klara@zblech:~/Dokumente/data/GitProjekte/rezeptsammlung/src/Klara/Herzhaftes$ mdbook serve
2026-01-03 10:42:02 [ERROR] (mdbook::utils): Error: Couldn't open SUMMARY.md in "/home/klara/Dokumente/data/GitProjekte/rezeptsammlung/src/Klara/Herzhaftes/src" directory
2026-01-03 10:42:02 [ERROR] (mdbook::utils):    Caused By: No such file or directory (os error 2)

This is a confusing error message, as if the reader is not experienced with reading error traces, they think

  • why does it fail, I can see the SUMMARY.md in my text editor tree (as they are just skimming the path)
  • Of course it fails, I don't have this src folder! (As they might not have an understanding how it internally builds the path)

I think this would be easy to improve with a hint

Proposed Solution

on ENOENT error handling (i.e. we are already on the slot path), recursively walk up the path to see whether a parent directory contains a src/SUMMARY.md. If so, print another [INFO] log on whether the user might meant to start it from the parent folder instead.

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.