pinpoint-apm/pinpoint · error · IllegalStateException
maxTryPerAttempt must be greater than 0
Error message
maxTryPerAttempt must be greater than 0
What it means
Builder validation in AgentInfoSender.Builder.build: maxTryPerAttempt was configured as <= 0 (unset default 0 or explicitly non-positive), so the sender cannot bound its retry attempts and construction is rejected.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/AgentInfoSender.java:253
this.sendIntervalMs = sendIntervalMs;
return this;
}
public Builder maxTryPerAttempt(int maxTryCountPerAttempt) {
this.maxTryPerAttempt = maxTryCountPerAttempt;
return this;
}
public AgentInfoSender build() {
if (this.refreshIntervalMs <= 0) {
throw new IllegalStateException("agentInfoRefreshIntervalMs must be greater than 0");
}
if (this.sendIntervalMs <= 0) {
throw new IllegalStateException("agentInfoSendIntervalMs must be greater than 0");
}
if (this.maxTryPerAttempt <= 0) {
throw new IllegalStateException("maxTryPerAttempt must be greater than 0");
}
return new AgentInfoSender(this);
}
}
}View on GitHub (pinned to 744c3d3075)
Solutions
- Call Builder.maxTryPerAttempt with a positive retry count before build()
- Check the agent info sender retry configuration for zero/negative values
Example fix
// before builder.setMaxTryPerAttempt(0).build(); // throws // after builder.setMaxTryPerAttempt(3).build();
Defensive patterns
Strategy: validation
Validate before calling
if (maxTryPerAttempt <= 0) {
throw new IllegalArgumentException("maxTryPerAttempt must be > 0");
} Try / catch
try {
sender = builder.setMaxTryPerAttempt(cfg).build();
} catch (IllegalStateException e) {
logger.warn("bad maxTryPerAttempt, using 3", e);
sender = builder.setMaxTryPerAttempt(3).build();
} Prevention
- Remember 0 does not mean 'disable retries' — use 1
- Validate retry counts in config loading
- Add builder-level defaults for missing config
When it happens
Trigger: Building AgentInfoSender with setMaxTryPerAttempt(0 or negative); typically from profiler.jvmInfo.maxTryPerAttempt (or similar) being zero/negative in config.
Common situations: Bad value in pinpoint.config for max retry count; copy-paste of 0 as 'disable retries' which is not supported; test harness builder misuse.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- agentInfoRefreshIntervalMs must be greater than 0
- agentInfoSendIntervalMs must be greater than 0
- service type name must not be empty
- Invalid serviceTypeCode or serviceTypeName
- Invalid time unit provided.
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/fc3ddeba8c90833e.
Report an issue: GitHub.