{"record":{"id":"6af88e38ca87b21a","repo":"apache/flink","slug":"the-value-text-cannot-be-re-represented-as-64b","errorCode":null,"errorMessage":"The value '{text}' cannot be re represented as 64bit number of bytes (numeric overflow).","messagePattern":"The value '(.+?)' cannot be re represented as 64bit number of bytes \\(numeric overflow\\)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core-api/src/main/java/org/apache/flink/configuration/MemorySize.java","lineNumber":305,"sourceCode":"            throw new NumberFormatException(\"text does not start with a number\");\n        }\n\n        final long value;\n        try {\n            value = Long.parseLong(number); // this throws a NumberFormatException on overflow\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\n                    \"The value '\"\n                            + number\n                            + \"' cannot be re represented as 64bit number (numeric overflow).\");\n        }\n\n        final long multiplier = parseUnit(unit).map(MemoryUnit::getMultiplier).orElse(1L);\n        final long result = value * multiplier;\n\n        // check for overflow\n        if (result / multiplier != value) {\n            throw new IllegalArgumentException(\n                    \"The value '\"\n                            + text\n                            + \"' cannot be re represented as 64bit number of bytes (numeric overflow).\");\n        }\n\n        return result;\n    }\n\n    private static Optional<MemoryUnit> parseUnit(String unit) {\n        if (matchesAny(unit, BYTES)) {\n            return Optional.of(BYTES);\n        } else if (matchesAny(unit, KILO_BYTES)) {\n            return Optional.of(KILO_BYTES);\n        } else if (matchesAny(unit, MEGA_BYTES)) {\n            return Optional.of(MEGA_BYTES);\n        } else if (matchesAny(unit, GIGA_BYTES)) {\n            return Optional.of(GIGA_BYTES);\n        } else if (matchesAny(unit, TERA_BYTES)) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core-api/src/main/java/org/apache/flink/configuration/MemorySize.java#L287-L323","documentation":"MemorySize.parseBytes throws IllegalArgumentException ('cannot be re represented as 64bit number of bytes (numeric overflow)') when value * unitMultiplier overflows a long. The numeric part parses fine, but applying the unit (e.g. 10000000 tb) wraps around; the overflow is detected by the round-trip check result / multiplier != value.","triggerScenarios":"parseBytes(\"10000000tb\") — 10 million terabytes exceeds Long.MAX_VALUE bytes; any large number combined with a large unit (gb/tb) whose product exceeds ~9.2 exabytes.","commonSituations":"Mentally swapping units (entering a mebi-byte figure as terabytes); copy-paste of the wrong magnitude into memory config; automated tools composing number+unit without range checks.","solutions":["Verify the unit matches the intended magnitude — human-scale memory values should use mb/gb","Pre-check: value must be <= Long.MAX_VALUE / multiplier for the chosen unit","Fix the source of the oversized number rather than downgrading the unit to mask it"],"exampleFix":"# before\nsize: 10000000tb  # numeric overflow when multiplied\n\n# after\nsize: 10000000mb  # or whatever magnitude was actually intended","handlingStrategy":"validation","validationCode":"// ensure value * unitMultiplier <= Long.MAX_VALUE\nif (value > Long.MAX_VALUE / multiplier) {\n    throw new IllegalArgumentException(\"value \" + raw + \" overflows byte range after unit applied\");\n}\nlong bytes = MemorySize.parseBytes(raw);","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { /* number*unit overflow — verify the unit matches the intended magnitude */ }","preventionTips":["Human-scale memory uses mb/gb units; tb with huge numbers is usually a unit mistake","Validate generated configs with a range check before deployment"],"tags":["memory","parsing","overflow","configuration","flink-core-api"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}