Skip to content

Syntax errors are not emitted in JSON format when using --output=json #21370

@correctmost

Description

@correctmost

Bug Report

To Reproduce

Run mypy --output=json invalid.py

invalid.py

x:

Expected Behavior

The output can be parsed as JSON

Actual Behavior

The default output format is used:

invalid.py:1: error: Invalid syntax  [syntax]
Found 1 error in 1 file (errors prevented further checking)

Your Environment

  • Mypy version used: mypy 1.20.2
  • Mypy command-line flags: --output=json
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions