-
Notifications
You must be signed in to change notification settings - Fork 1
Troubleshooting
Arun Prakash edited this page Sep 21, 2025
·
6 revisions
- Symptom:
FormatException: Invalid size format - Causes:
- Typos or unknown symbols (e.g.,
XB) - JEDEC/IEC mismatch (e.g.,
KiBparsed under SI)
- Typos or unknown symbols (e.g.,
- Fixes:
- Ensure
standardmatches your input:si | iec | jedec - Use full-form words when unsure (e.g.,
megabytes,kibibytes)
- Ensure
-
ByteConverter(-1)or parsing a negative size throwsArgumentError. - Ensure upstream inputs are sanitized before parsing.
- Lowercase
bdenotes bits; uppercaseBdenotes bytes. - Using
useBytes: falseformats values in bits; setuseBytes: trueto force bytes.
-
forceUnitpins the unit (e.g.,MB,MiB,Gb) and disables auto-scaling. - When using bits, byte units are mapped to bit units where possible (e.g.,
KB->Kb).
- Use
separator(e.g.,,) andspacer(e.g., empty string) to control visuals. -
minimumFractionDigits/maximumFractionDigitsoverrideprecisionrounding style.
-
DataRate.parse('1 MB/s', standard: ByteStandard.iec)will throw (unit inconsistent with IEC). - Prefer
DataRate.parse('1 MiB/s', standard: ByteStandard.iec)for IEC.
- Prefer
BigByteConverterfor exact integer math at EB/ZB/YB scales. - Use
parseByteSizeAutoto decide automatically.
- Log the normalized number/string or run with simpler inputs (e.g., remove grouping) to isolate issues.
- Cross-check with tests in
test/for expected behaviors and edge cases.