Skip to content
Mintlify
Mintlify

Publish button disabled because of invalid MDX

Why the Publish button in the editor is disabled with the message 'Fix invalid MDX before publishing' and how to find and fix the page with the error.

If you cannot click the Publish button in the editor and hovering over it shows the Fix invalid MDX before publishing error tooltip, at least one page on your branch has MDX that fails to parse. The editor blocks publishing until every page on the branch parses successfully. This keeps broken syntax from reaching your live site.

The tooltip tells you how many pages have errors. The same error blocks Request review on feature branches. Common causes include:

  • An unclosed component tag, such as a <Note> without a matching </Note>.
  • Malformed JSX in the page body, such as an unclosed brace in an expression.
  • Frontmatter that isn’t valid YAML, such as inconsistent indentation or an unclosed quote.

While a page has invalid MDX or invalid frontmatter YAML, those edits stay local to you. Teammates editing the same page only receive valid content, so a syntax error you introduce doesn’t overwrite their work. See Collaborate in the editor for how real-time editing handles invalid content.

Fix the error manually

  1. Open the affected page in the editor.
  2. Switch to source mode with Cmd + Shift + S (macOS) or Ctrl + Shift + S (Windows). Source mode highlights the invalid MDX and shows the parsing error.
  3. Fix the syntax. Once the page parses, the error clears and the Publish button becomes available again.

Fix the error with the agent

  1. Open the editor panel.
  2. Prompt the agent to fix any invalid MDX or frontmatter YAML.
Was this page helpful?Suggest editsRaise issue