pinpoint-apm/pinpoint · warning · IllegalArgumentException

args size not equal

Error message

args size not equal

What it means

ApiUtils.mergeParameterVariableNameDescription merges JVM parameter type names with their variable names into an API descriptor string like '(int a, java.lang.String b)'. The two arrays are treated as index-aligned pairs, so mismatched lengths indicate corrupt metadata and IllegalArgumentException is thrown.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/util/ApiUtils.java:38

/**
 * @author emeroad
 * @author jaehong.kim
 */
public final class ApiUtils {

    private final static String EMPTY_ARRAY = "()";

    private ApiUtils() {
    }

    public static String mergeParameterVariableNameDescription(String[] parameterType, String[] variableName) {
        if (parameterType == null && variableName == null) {
            return EMPTY_ARRAY;
        }
        if (variableName != null && parameterType != null) {
            if (parameterType.length != variableName.length) {
                throw new IllegalArgumentException("args size not equal");
            }
            if (parameterType.length == 0) {
                return EMPTY_ARRAY;
            }
            StringBuilder sb = new StringBuilder(64);
            sb.append('(');
            int end = parameterType.length - 1;
            for (int i = 0; i < parameterType.length; i++) {
                sb.append(parameterType[i]);
                sb.append(' ');
                sb.append(variableName[i]);
                if (i < end) {
                    sb.append(", ");
                }
            }
            sb.append(')');
            return sb.toString();
        }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Ensure parameterType and variableName arrays are generated from the same method metadata and have equal length
  2. Compile target classes with debug info (-g) so variable names match parameter counts
  3. Pass null for one of the arrays (not mismatched arrays) to get the fallback behavior
  4. Add an assertion/length check where the arrays are constructed

Example fix

// before
ApiUtils.mergeParameterVariableNameDescription(new String[]{"int","String"}, new String[]{"a"}); // throws
// after
if (parameterTypes.length == variableNames.length) {
    ApiUtils.mergeParameterVariableNameDescription(parameterTypes, variableNames);
}
Defensive patterns

Strategy: validation

Validate before calling

if (parameterType != null && variableName != null && parameterType.length != variableName.length) { throw new IllegalStateException("parameter/variable arrays must align"); }

Try / catch

try { desc = ApiUtils.mergeParameterVariableNameDescription(types, names); } catch (IllegalArgumentException e) { desc = String.join(",", types); }

Prevention

When it happens

Trigger: Calling mergeParameterVariableNameDescription(parameterType, variableName) with both arrays non-null but of different lengths.

Common situations: Plugin metadata where parameter types were parsed from bytecode but variable names come from debug info compiled without -g or from a stale cache; mismatched arrays built by hand.

Related errors


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