t8y2/dbx · error · IllegalArgumentException
Agent runtime thread limits must be positive
Error message
Agent runtime thread limits must be positive
What it means
The RuntimeLimits constructor validates its thread-pool bounds and throws IllegalArgumentException if either maximumRequestThreads or maximumCleanupThreads is <= 0. It is a fail-fast guard ensuring the server always configures positive thread limits for its executor pools.
Source
Thrown at agents/common/src/main/java/com/dbx/agent/MultiSessionJsonRpcServer.java:359
private static JsonObject errorResponse(JsonElement id, Throwable error) {
JsonObject response = new JsonObject();
response.addProperty("jsonrpc", "2.0");
response.add("id", id);
response.add("error", AgentRpcError.toJson(error, "request", null));
return response;
}
private static String stringOrNull(JsonObject params, String key) {
return params.has(key) && !params.get(key).isJsonNull() ? params.get(key).getAsString() : null;
}
static final class RuntimeLimits {
private final int maximumRequestThreads;
private final int maximumCleanupThreads;
RuntimeLimits(int maximumRequestThreads, int maximumCleanupThreads) {
if (maximumRequestThreads <= 0 || maximumCleanupThreads <= 0) {
throw new IllegalArgumentException("Agent runtime thread limits must be positive");
}
this.maximumRequestThreads = maximumRequestThreads;
this.maximumCleanupThreads = maximumCleanupThreads;
}
private static RuntimeLimits defaults() {
return new RuntimeLimits(MAX_REQUEST_THREADS, MAX_CLEANUP_THREADS);
}
}
private static String requiredSessionId(JsonObject params) {
if (!params.has("agentSessionId") || params.get("agentSessionId").getAsString().trim().isEmpty()) {
throw new IllegalArgumentException("agentSessionId is required");
}
return params.get("agentSessionId").getAsString();
}
private void writeResponse(JsonObject response) {View on GitHub (pinned to c0390bff16)
Solutions
- Pass positive values for both limits (use RuntimeLimits defaults if unsure)
- Validate config values before constructing and fall back to defaults on invalid input
- Fix the configuration source so thread-count properties are positive integers
- Add a startup assertion/log when config-derived values are non-positive
Example fix
// before
int threads = Integer.parseInt(cfg.get("requestThreads")); // 0 on missing
new MultiSessionJsonRpcServer(agent, threads, threads);
// after
int threads = Math.max(1, Integer.parseInt(cfg.getOrDefault("requestThreads", "8")));
new MultiSessionJsonRpcServer(agent, threads, Math.max(1, cleanupThreads)); Defensive patterns
Strategy: validation
Validate before calling
int req = parsePositive(cfg, "requestThreads", 8); int cleanup = parsePositive(cfg, "cleanupThreads", 2); // parsePositive throws/defaults when value <= 0 new MultiSessionJsonRpcServer(agent, req, cleanup);
Type guard
boolean validLimits(int req, int cleanup) { return req > 0 && cleanup > 0; } Try / catch
try {
limits = new RuntimeLimits(reqThreads, cleanupThreads);
} catch (IllegalArgumentException e) {
limits = RuntimeLimits.defaults(); // fall back to built-in positive defaults
} Prevention
- Clamp parsed config values with Math.max(1, value)
- Use the defaults factory when config is absent or invalid
- Fail at config-load time with a clear message, not deep in the constructor
- Cover thread-limit parsing with unit tests including 0 and negatives
When it happens
Trigger: Constructing MultiSessionJsonRpcServer (or RuntimeLimits directly) with 0 or negative values, typically from misread config properties, integer-parse fallbacks, or constants defined as 0.
Common situations: Config file with 'threads=0' or a negative override; parsing empty strings to 0 and passing them through; unit tests probing validation; copy-paste errors in constant definitions.
Understand the failure class
Background: "Invalid configuration value" and "Unsupported/Unknown setting value" errors: why libraries reject your config strings, numbers, and types — this error's family across 30 libraries.
Related errors
- Unsupported H2 driver profile: " + profile
- Custom H2 driver profile requires at least one JDBC JAR path
- JDBC URL is required.
- BENCH_CANDIDATES selected no candidates
- unknown workload kind: {workload['kind']}
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/63479636cbbc258a.
Report an issue: GitHub.