{"record":{"id":"26c937e89c678d7c","repo":"prestodb/presto","slug":"value-must-be-0-found","errorCode":null,"errorMessage":"value must be > 0, found: ","messagePattern":"value must be > 0, found: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/SplitWeight.java","lineNumber":42,"sourceCode":"import java.util.function.Function;\n\nimport static java.lang.Math.addExact;\nimport static java.lang.Math.multiplyExact;\n\n@ThriftStruct\npublic final class SplitWeight\n{\n    private static final long UNIT_VALUE = 100;\n    private static final int UNIT_SCALE = 2; // Decimal scale such that (10 ^ UNIT_SCALE) == UNIT_VALUE\n    private static final SplitWeight STANDARD_WEIGHT = new SplitWeight(UNIT_VALUE);\n\n    private final long value;\n\n    @ThriftConstructor\n    public SplitWeight(long value)\n    {\n        if (value <= 0) {\n            throw new IllegalArgumentException(\"value must be > 0, found: \" + value);\n        }\n        this.value = value;\n    }\n\n    /**\n     * @return The internal integer representation for this weight value\n     */\n    @JsonValue\n    @ThriftField(value = 1, name = \"value\")\n    public long getRawValue()\n    {\n        return value;\n    }\n\n    @Override\n    public boolean equals(Object other)\n    {\n        if (!(other instanceof SplitWeight)) {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/SplitWeight.java#L24-L60","documentation":"SplitWeight wraps a strictly positive internal long value. The @ThriftConstructor SplitWeight(long value) throws IllegalArgumentException(\"value must be > 0, found: ...\") if a non-positive raw value is supplied.","triggerScenarios":"Constructing SplitWeight directly (or deserializing via Thrift/JSON) with raw value <= 0, e.g. SplitWeight.fromRawValue(0) or new SplitWeight(-5).","commonSituations":"Persisting split weights to a store that zeros them out; computing raw weights with integer division that truncates to 0; deserializing old/partial data lacking a weight value (default 0).","solutions":["Ensure raw weight values are strictly positive before constructing; use SplitWeight.fromProportion for fractions","Fix serialization/deserialization so defaults become STANDARD_WEIGHT rather than 0","Guard: if (raw <= 0) use SplitWeight.STANDARD_WEIGHT instead of new SplitWeight(raw)"],"exampleFix":"// before\nSplitWeight w = new SplitWeight(0);\n// after\nSplitWeight w = raw > 0 ? new SplitWeight(raw) : SplitWeight.STANDARD_WEIGHT;","handlingStrategy":"validation","validationCode":"if (rawValue <= 0) throw new IllegalArgumentException(\"raw value must be > 0: \" + rawValue);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use SplitWeight.fromProportion or STANDARD_WEIGHT instead of raw constructors","Ensure serialized weight fields default to STANDARD_WEIGHT, never 0"],"tags":["spi","illegal-argument","split-weight"],"backgroundTag":"invalid-numeric-value","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}