pinpoint-apm/pinpoint · error · IllegalArgumentException

negative tieOffset:<tieOffset>

Error message

negative tieOffset:<tieOffset>

What it means

Constructor argument validation in LastRowWithTiesResultsExtractor: tieOffset must be >= 0 because it is a row offset into the tie group appended to the limited result. A negative value is a caller programming bug, so the constructor fails fast with IllegalArgumentException.

Source

Thrown at commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/LastRowWithTiesResultsExtractor.java:56

    private final int limit;
    private final RowMapper<T> rowMapper;
    private final int tieOffset;
    private final int tieLength;

    @Nullable
    private final LastRowHandler<T> rowHandler;
    private final ToIntFunction<T> resultSizeHandler;

    public LastRowWithTiesResultsExtractor(RowMapper<T> rowMapper,
                                           int limit,
                                           int tieOffset,
                                           int tieLength,
                                           @Nullable LastRowHandler<T> rowHandler) {
        this.rowMapper = Objects.requireNonNull(rowMapper, "RowMapper");
        this.limit = limit;
        if (tieOffset < 0) {
            throw new IllegalArgumentException("negative tieOffset:" + tieOffset);
        }
        this.tieOffset = tieOffset;
        if (tieLength <= 0) {
            throw new IllegalArgumentException("non-positive tieLength:" + tieLength);
        }
        this.tieLength = tieLength;
        this.rowHandler = rowHandler;
        this.resultSizeHandler = resolveResultSizeHandler(rowMapper);
    }

    private ToIntFunction<T> resolveResultSizeHandler(RowMapper<T> rowMapper) {
        if (rowMapper instanceof RowTypeHint hint) {
            Class<?> clazz = hint.rowType();
            return ResultSizeHandlers.getHandler(clazz);
        }
        return new LazyResultSizeHandler<>();
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Pass tieOffset >= 0; use 0 when no offset into the tie rows is desired
  2. Fix the pagination arithmetic that produced the negative offset
  3. Clamp the value: Math.max(0, tieOffset) at the call site if a sentinel -1 is possible

Example fix

// before
new LastRowWithTiesResultsExtractor<>(mapper, limit, -1, tieLength, handler);
// after
new LastRowWithTiesResultsExtractor<>(mapper, limit, 0, tieLength, handler);
Defensive patterns

Strategy: validation

Validate before calling

if (tieOffset < 0) throw new IllegalArgumentException("tieOffset must be >= 0, got " + tieOffset);

Prevention

When it happens

Trigger: Calling new LastRowWithTiesResultsExtractor<>(rowMapper, limit, tieOffset, tieLength, rowHandler) with a negative tieOffset (e.g. computing offset as (page-1)*size where page is 0 or negative).

Common situations: Pagination math bugs (page 0 offset subtraction), passing -1 as a sentinel 'no offset' value where 0 is required.

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/e6a905dafe2a8f4f. Report an issue: GitHub.