iflytek/astron-agent · error · BusinessException
RESPONSE_FAILED
RESPONSE_FAILED
Error message
Bearer key must not be blank
What it means
getRpaList validates its parameters before issuing the HTTP request; an empty or null bearer key ('key') fails fast with BusinessException(RESPONSE_FAILED, "Bearer key must not be blank"). This is a client-side argument validation error — no network call is made.
Solutions
- Configure a valid non-blank RPA bearer key before calling getRpaList
- Check where the key is sourced (config table/env/user input) and why it is empty
- Re-obtain or regenerate the RPA token if it expired and was wiped
- Add a pre-flight check in the UI to require the key before invoking RPA listing
Example fix
// before
rpaHandler.getRpaList(pageNo, pageSize, key); // key may be blank
// after
if (key == null || key.isBlank()) {
throw new IllegalArgumentException("RPA bearer key is not configured");
}
rpaHandler.getRpaList(pageNo, pageSize, key.trim()); Defensive patterns
Strategy: validation
Validate before calling
if (key == null || key.isBlank()) {
throw new IllegalStateException("RPA bearer key is not configured");
}
rpaHandler.getRpaList(pageNo, pageSize, key.trim()); Type guard
boolean hasBearerKey(String key) {
return key != null && !key.isBlank();
} Prevention
- Store the RPA bearer key in configuration and fail fast at startup if missing
- Trim user-supplied tokens before use
- Add a UI-level check that a token exists before enabling RPA features
When it happens
Trigger: Calling getRpaList with key == null, key.isBlank(), or an empty/whitespace-only bearer token string.
Common situations: RPA token not configured in the environment/user settings; token cleared or never stored; frontend passing an empty key after logout or config reset.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/45f279781b938c4b.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/handler/RpaHandler.java:52
/**
* Get RPA workflow list from downstream API.
*
* <p>
* Performs parameter validation, constructs request URL, invokes HTTP call, parses the response,
* and returns the workflow list data.
* </p>
*
* @param pageNo page number (>= 1, default 1 if null)
* @param pageSize page size (1~1000, default 20 if null; values outside the range will be trimmed)
* @param key secret/token used to generate Bearer Token (must not be blank)
* @return {@link JSONObject} containing workflow list data
* @throws BusinessException if parameters are invalid, HTTP call fails, response parsing fails, or
* downstream returns a non-zero code
*/
public JSONObject getRpaList(Integer pageNo, Integer pageSize, String key) {
// 1) Validate and normalize parameters
if (key == null || key.isBlank()) {
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Bearer key must not be blank");
}
int safePageNo = Math.max(1, Objects.requireNonNullElse(pageNo, 1));
int safePageSize = Math.min(Math.max(Objects.requireNonNullElse(pageSize, 20), 1), 1000);
final String base = apiUrl.getRpaUrl();
if (base == null || base.isBlank()) {
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "RPA base url is not configured");
}
// 2) Build request URL and headers
final String url = String.format("%s%s?pageNo=%d&pageSize=%d", base, RPA_ROBOT_LIST, safePageNo, safePageSize);
final Map<String, String> headers = Map.of(
"Authorization", "Bearer " + key,
"Accept", "application/json; charset=utf-8");
log.info("getRpaList -> url: {}, headers: {}", url, headers);
// 3) Call downstream API and parse responseView on GitHub (pinned to 5e758547a8)