iflytek/astron-agent · warning · IOException
exceeds size limit
Error message
exceeds size limit
What it means
readBounded enforces a hard size cap on HTTP response bodies. Before streaming, it validates the declared Content-Length: if body.contentLength() exceeds the limit it immediately throws "<description> exceeds size limit" without reading the body. This protects the console backend from a malicious or misconfigured server delivering an oversized sandbox response or skill resource.
Solutions
- Reduce the requested resource/response size (truncate, paginate, or fetch a smaller artifact).
- If the resource is legitimately needed, raise the maxResourceBytes limit passed to downloadText.
- Check why the server declares a larger Content-Length than expected — possibly the wrong file is being served.
- Compress resources server-side so their transferred size fits within the cap.
Example fix
// before String text = service.downloadText(url, 1024); // resource is 500KB -> rejected before read // after long resourceSize = headContentLength(url); long limit = Math.max(resourceSize + 1, MAX_RESOURCE_BYTES); String text = service.downloadText(url, limit);
Defensive patterns
Strategy: validation
Validate before calling
long declared = httpHead(url).headers().get("Content-Length") != null
? Long.parseLong(httpHead(url).headers().get("Content-Length")) : -1;
if (declared > maxResourceBytes) {
throw new IllegalArgumentException("Resource too large: " + declared + " > " + maxResourceBytes);
} Try / catch
try {
String content = service.downloadText(url, maxResourceBytes);
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().endsWith("exceeds size limit")) {
// fetch a smaller artifact or raise the configured limit
}
} Prevention
- Keep skill resources under the configured size cap and enforce the cap at publish time.
- Periodically review limit configuration against actual resource sizes.
- Compress large resources server-side before exposing download URLs.
When it happens
Trigger: A sandbox response or skill resource whose declared Content-Length header is larger than maxSandboxResponseBytes / maxResourceBytes when executeSandbox or downloadText calls readBounded.
Common situations: A skill resource file genuinely larger than the configured cap; a compromised/foreign resource server lying about or sending huge Content-Length; a configured limit left at a very small default while real resources grew; sandbox echoing back a much larger payload than submitted.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- sandbox-exec failed: HTTP
- Skill resource URL is not allowed
- Skill resource download failed: HTTP
- AUDIO_FILE_SIZE_EXCEEDED
- PARAM_ERROR
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/32148bb713410d77.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/springai/SkillRuntimeToolService.java:138
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("Skill resource download failed: HTTP " + response.code());
}
ResponseBody body = response.body();
if (body == null) {
throw new IOException("Skill resource download returned empty body");
}
return decodeText(readBounded(body, maxResourceBytes, "Skill resource"), body);
}
}
private byte[] readBounded(ResponseBody body, long limit, String description)
throws IOException {
validateLimit(limit, description);
long contentLength = body.contentLength();
if (contentLength > limit) {
throw new IOException(description + " exceeds size limit");
}
int readLimit = Math.toIntExact(limit + 1);
try (InputStream input = body.byteStream()) {
byte[] bytes = input.readNBytes(readLimit);
if (bytes.length > limit) {
throw new IOException(description + " exceeds size limit");
}
return bytes;
}
}
private void validateLimit(long limit, String description) throws IOException {
if (limit < 1 || limit > MAX_CONFIGURABLE_RESPONSE_BYTES) {
throw new IOException(description + " size limit is invalid");
}
}
private String decodeText(byte[] bytes, ResponseBody body) {View on GitHub (pinned to 5e758547a8)