pinpoint-apm/pinpoint · error · IllegalArgumentException

limit must be positive or -1(unlimited): <limit>

Error message

limit must be positive or -1(unlimited): <limit>

What it means

ColumnGetCount.of validates the column fetch limit: -1 (or the UNLIMITED_COUNT sentinel) maps to an unlimited singleton, but any other value must be strictly positive. Zero or other negatives are rejected with IllegalArgumentException because they are not meaningful limits for HBase gets.

Source

Thrown at commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/bo/ColumnGetCount.java:38

import org.apache.hadoop.hbase.filter.ColumnCountGetFilter;
import org.apache.hadoop.hbase.filter.Filter;

/**
 * @author Taejin Koo
 */
public class ColumnGetCount {

    public static final int UNLIMITED_COUNT = Integer.MAX_VALUE;
    public static final ColumnGetCount UNLIMITED_COLUMN_GET_COUNT = new ColumnGetCount(UNLIMITED_COUNT);

    private final int limit;

    public static ColumnGetCount of(int limit) {
        if (limit == -1 || limit == UNLIMITED_COUNT) {
            return ColumnGetCount.UNLIMITED_COLUMN_GET_COUNT;
        }
        if (limit <= 0) {
            throw new IllegalArgumentException("limit must be positive or -1(unlimited): " + limit);
        }
        return new ColumnGetCount(limit);
    }

    ColumnGetCount(int limit) {
        Assert.isTrue(limit > 0, "limit must be 'limit >= 0'");
        this.limit = limit;
    }

    public int getLimit() {
        return limit;
    }

    public boolean isReachedLimit(int resultSize) {
        if (limit == UNLIMITED_COUNT) {
            return false;
        }
        return resultSize >= limit;

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Pass limit >= 1 for a bounded get, or exactly -1 for unlimited
  2. Fix the config/property parsing that produced 0 and map 'unset' to -1 instead
  3. Guard at the call site: use limit <= 0 ? ColumnGetCount.UNLIMITED_COLUMN_GET_COUNT : ColumnGetCount.of(limit) only if that matches your intent

Example fix

// before
ColumnGetCount.of(maxColumns); // maxColumns=0 from unset property
// after
ColumnGetCount.of(maxColumns <= 0 ? -1 : maxColumns);
Defensive patterns

Strategy: validation

Validate before calling

int safeLimit = (limit == -1 || limit <= 0) ? -1 : limit;
ColumnGetCount count = ColumnGetCount.of(safeLimit); // -1 => unlimited

Try / catch

try {
    return ColumnGetCount.of(rawLimit);
} catch (IllegalArgumentException e) {
    logger.warn("Invalid column limit {}, defaulting to unlimited", rawLimit);
    return ColumnGetCount.UNLIMITED_COLUMN_GET_COUNT;
}

Prevention

When it happens

Trigger: Calling ColumnGetCount.of(0) or of(-2), often from code that treats 0 as 'no limit' or -1/-2 as sentinels from configuration parsing.

Common situations: Config properties for max column count parsed to 0 when unset; callers passing -1 variants (e.g. -2 from a different sentinel convention) expecting unlimited semantics.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/26f86f23803b119a. Report an issue: GitHub.