iflytek/astron-agent · error · IOException
Workflow chat HTTP " + response.code()
Error message
Workflow chat HTTP " + response.code()
What it means
WorkflowChatRunClient.chat performs an OkHttp POST to the workflow chat HTTP endpoint and throws a plain IOException when the HTTP status is not 2xx, embedding the status code in the message. Callers (per tests) translate this into readable error/interrupt messages rather than letting it propagate raw.
Solutions
- Check response.code() in the message: 401/403 → fix Authorization (Bearer apiKey:apiSecret) and internal API key configuration; 404 → fix endpoint URL; 5xx → check core/workflow service health
- Verify commonConfig.getApiKey()/getApiSecret() are set and match the workflow service's expectations
- Confirm the core workflow service is reachable from the console backend (network/DNS, docker network)
- Catch this IOException in callers and map status codes to user-facing messages as the existing tests do
Example fix
// before
throw new IOException("Workflow chat HTTP " + response.code());
// after
String errBody = response.body() != null ? response.body().string() : "";
throw new IOException("Workflow chat HTTP " + response.code() + ": " + StringUtils.abbreviate(errBody, 500)); Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: assert config present Assert.hasText(commonConfig.getApiKey(), "apiKey missing"); Assert.hasText(commonConfig.getApiSecret(), "apiSecret missing");
Try / catch
try {
String body = chat(request);
} catch (IOException e) {
int status = parseStatusCode(e.getMessage()); // "Workflow chat HTTP <code>"
switch (status) { case 401: case 403: fixAuth(); break; case 404: fixUrl(); break; default: retryOrAlert(); }
} Prevention
- Verify internal API key and apiKey:apiSecret pair are configured and not rotated
- Health-check the core workflow service before dispatching chat runs
- Map known HTTP statuses to readable messages in callers, as existing tests do
When it happens
Trigger: The workflow chat endpoint returns 401/403 (bad internal API key or Authorization header), 404 (wrong base URL/path), 429 (rate limit), or 5xx (core workflow service down) so response.isSuccessful() is false.
Common situations: Misconfigured commonConfig apiKey/apiSecret; internal API key not configured (WorkflowInternalApiKey.requireConfigured passed earlier but rotated/expired); wrong service URL or the core/workflow service not running; gateway rejecting the Bearer token format.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- sandbox-exec failed: HTTP
- Skill resource download failed: HTTP
- exceeds size limit
- MODEL_CHECK_FAILED
- REPO_KNOWLEDGE_DOWNLOAD_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/5f1729504b014bde.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowChatRunClient.java:55
private String chatUrl;
@Value("${workflow.internal-api-key:}")
private String workflowInternalApiKey;
/** POST the chat request and return the raw response body (final LLMGenerate JSON frame). */
public String chat(JSONObject requestBody) throws IOException {
Request request = new Request.Builder()
.url(chatUrl)
.header("X-Consumer-Username", commonConfig.getAppId())
.header(
WorkflowInternalApiKey.HEADER,
WorkflowInternalApiKey.requireConfigured(workflowInternalApiKey))
.header("Authorization", "Bearer " + commonConfig.getApiKey() + ":" + commonConfig.getApiSecret())
.post(RequestBody.create(requestBody.toJSONString(), JSON_MEDIA))
.build();
try (Response response = CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("Workflow chat HTTP " + response.code());
}
ResponseBody body = response.body();
return body == null ? "" : body.string();
}
}
}
View on GitHub (pinned to 5e758547a8)