{"record":{"id":"58f55755ccf25cf4","repo":"denoland/deno","slug":"formatting-not-stable-bailed-after-tries-this","errorCode":null,"errorMessage":"Formatting not stable. Bailed after {} tries. This indicates a bug in the formatter where it formats the file differently each time. As a temporary workaround you can ignore this file.","messagePattern":"Formatting not stable\\. Bailed after (.+?) tries\\. This indicates a bug in the formatter where it formats the file differently each time\\. As a temporary workaround you can ignore this file\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/fmt.rs","lineNumber":1227,"sourceCode":"          }\n          Ok(None) => {\n            return Ok(Some(current_text));\n          }\n          Err(err) => {\n            bail!(\n              concat!(\n                \"Formatting succeeded initially, but failed when ensuring a \",\n                \"stable format. This indicates a bug in the formatter where \",\n                \"the text it produces is not syntactically correct. As a temporary \",\n                \"workaround you can ignore this file.\\n\\n{:#}\"\n              ),\n              err,\n            )\n          }\n        }\n        count += 1;\n        if count == 5 {\n          bail!(\n            concat!(\n              \"Formatting not stable. Bailed after {} tries. This indicates a bug \",\n              \"in the formatter where it formats the file differently each time. As a \",\n              \"temporary workaround you can ignore this file.\"\n            ),\n            count,\n          )\n        }\n      }\n    }\n    None => Ok(None),\n  }\n}\n\n/// Format stdin and write result to stdout.\n/// Treats input as set by `--ext` flag.\n/// Compatible with `--check` flag.\nfn format_stdin(","sourceCodeStart":1209,"sourceCodeEnd":1245,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/fmt.rs#L1209-L1245","documentation":"`deno fmt` verifies idempotency: it re-formats its own output up to 5 times and expects identical text. This error means each pass produced different text (a formatting cycle), so the formatter is non-idempotent for this file — a bug in the formatter, not in your code.","triggerScenarios":"The loop in cli/tools/fmt.rs keeps getting next_pass_text != current_text; after the 5th pass (count == 5) it bails. Triggered by source constructs where two formatting rules keep flip-flopping (e.g. line-wrapping decisions in long expressions, comment alignment in markdown or CSS-in-template-literals).","commonSituations":"Formatter regressions after a Deno version bump; files with very long lines, dense destructuring, or markdown tables that alternate between two layouts; CI failing with 'not stable' on a file humans never touched.","solutions":["Exclude the file: `// deno-fmt-ignore-file` at the top, or \"fmt\": { \"exclude\": [...] } in deno.json","Try a different Deno version — check the changelog for formatter fixes and upgrade","Reduce to a minimal reproduction and file it at github.com/denoland/deno/issues so the cycle gets fixed"],"exampleFix":"# before: `deno fmt src/big_file.ts` -> Formatting not stable. Bailed after 5 tries.\n\n# after: first line of src/big_file.ts\n// deno-fmt-ignore-file","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Catch the non-zero exit of `deno fmt <file>`; if stderr contains 'Formatting not stable', mark the file with `// deno-fmt-ignore-file` (or add to deno.json fmt.exclude) and re-run the batch, recording which files were skipped for follow-up.","preventionTips":["Test formatting in CI with `deno fmt --check` on the pinned Deno version","Upgrade Deno deliberately and re-run fmt across the repo once, in a dedicated commit","Report instability reproductions upstream — the workaround (ignore) is meant to be temporary"],"tags":["fmt","formatter","idempotency","bug","fixpoint"],"backgroundTag":"formatter-unstable-output","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}