Skip to content
Latchkey

MkDocs "contains a link ... not found among documentation files" (strict) in CI

A Markdown page links to another doc that MkDocs cannot resolve to a file. Normally this is a warning; with --strict it becomes a BuildError and fails CI.

What this error means

mkdocs build (with --strict) reports "Doc file 'X.md' contains a link 'Y.md' which is not found in the documentation files" and aborts.

mkdocs
WARNING  -  Doc file 'guide/index.md' contains a link 'setup.md', but the target
'guide/setup.md' is not found among documentation files.
Aborted with a BuildError!

Common causes

The linked page was moved or renamed

The relative link still points to the old path after the target file was renamed or relocated under docs/.

A wrong relative path

The link is relative to the current file; an incorrect prefix or missing directory makes MkDocs unable to resolve it.

How to fix it

Correct the relative link

  1. Read the source file and target the warning names.
  2. Fix the link to the real relative path of the target Markdown file.
  3. Rebuild with --strict to confirm it resolves.
docs/guide/index.md
[Setup guide](../setup.md)

Keep links as Markdown file paths

Link to the source .md files (not the built URLs) so MkDocs can validate them at build time.

How to prevent it

  • Link to source .md files using correct relative paths.
  • Update links whenever you move or rename pages.
  • Run mkdocs build --strict so broken links fail CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →