Skip to content
Latchkey

twine check "long_description has syntax errors" in CI

twine check rendered your long_description (the README) the way PyPI would and found markup it cannot render. PyPI would show a broken or empty project page, so check flags it before upload.

What this error means

twine check dist/* prints "warning: long_description has syntax errors in markup and would not be rendered on PyPI." and exits non-zero when run with --strict.

twine
Checking dist/my_pkg-1.0.0-py3-none-any.whl: FAILED
  warning: `long_description` has syntax errors in markup and would not be rendered on PyPI.
    line 12: Inline strong start-string without end-string.

Common causes

Invalid reStructuredText in the README

If long_description_content_type is text/x-rst, malformed RST (unbalanced markup, bad directives) fails rendering and check reports the line.

A wrong or missing content type

A Markdown README declared as RST (or with no content type) cannot render, so check warns it would not display on PyPI.

How to fix it

Declare the correct long_description_content_type

Match the content type to the README format so PyPI renders it. For a Markdown README, set text/markdown.

pyproject.toml
[project]
readme = "README.md"
# or, in setup.py:
# long_description_content_type = "text/markdown"

Run twine check in CI before upload

Gate the release on a strict check so broken markup fails fast instead of producing a blank PyPI page.

Terminal
python -m build
twine check --strict dist/*

How to prevent it

  • Set long_description_content_type to match the README format.
  • Add twine check --strict as a CI step before upload.
  • Preview RST/Markdown rendering locally for non-trivial READMEs.

Related guides

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