Skip to content

Unclear error if line-length goes beyond u16 boundaries #21328

@chirizxc

Description

@chirizxc

Summary

Refs #20823

ruff.toml:

line-length = 99_999
❯ ruff check
ruff failed                                                                                                                                           
  Cause: Failed to load configuration `...`
  Cause: Failed to parse ...
  Cause: TOML parse error at line 3, column 15
  |
3 | line-length = 99_999
  |               ^^^^^^
invalid value: integer `99999`, expected u16

From TOML spec:

Arbitrary 64-bit signed integers (from −2^63 to 2^63−1) should be accepted and handled losslessly. If an integer cannot be represented losslessly, an error must be thrown.

❯ bat ruff.toml                                                                                                                                       
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: ruff.toml
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ target-version = "py310"
   2   │ 
   3 ~ │ line-length = 65535
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ ruff check
ruff failed                                                                                                                                           
  Cause: Failed to load configuration `...`
  Cause: Failed to parse ...
  Cause: TOML parse error at line 3, column 15
  |
3 | line-length = 65535
  |               ^^^^^
line-length must be between 1 and 320 (got 65535)

and

❯ bat ruff.toml                                                                                                                                       
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: ruff.toml
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ target-version = "py310"
   2   │ 
   3 ~ │ line-length = 65536
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ ruff check
ruff failed                                                                                                                                           
  Cause: Failed to load configuration `...`
  Cause: Failed to parse ...
  Cause: TOML parse error at line 3, column 15
  |
3 | line-length = 65536
  |               ^^^^^
invalid value: integer `65536`, expected u16

Version

ruff 0.14.4 (c7ff9826d 2025-11-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions