#8490·sqlfluff

sqlfluff lint --format json --bench produces invalid JSON on stdout

Author: udsy19Created Sep 14, 2026Updated Sep 14, 2026

What Happened

sqlfluff lint --format json --bench writes the JSON payload to stdout, then unconditionally prints a plain-text ==== overall timings ==== benchmark table right after it via click.echo(). The combined stdout is not valid JSON.

$ sqlfluff lint --format json --bench --dialect ansi -
[{"filepath": "stdin", "violations": [], ...}]
==== overall timings ====
Clock time:     0.07
...

Piping that to jq (or json.load) fails with "Extra data". The same applies to --format yaml/sarif/gitlab/github-annotation combined with --bench and no --write-output. sqlfluff parse --bench does not have this problem - it only prints the bench summary for --format human.

Expected Behaviour

--bench's timing summary should not corrupt a machine-readable --format on stdout, matching how sqlfluff parse already handles it.

Observed Behaviour

Combined stdout fails json.loads() / yaml.safe_load() with "Extra data".

How to reproduce

echo 'select 1' | sqlfluff lint --format json --bench --dialect ansi -

Dialect

ansi (reproduces with any dialect - the bug is in output formatting, not parsing).

Version

Current main (818243e).

Configuration

N/A - reproduces with default config, no .sqlfluff file needed.