iflytek/astron-agent · error · BusinessException
8309
8309
Error message
toolbox.param.get.source.illegal
What it means
validateFromValue enforces that the 'from' field of a tool parameter (its value source) is exactly 0, 1, or 2. A null value or any other integer is rejected with TOOLBOX_PARAM_GET_SOURCE_ILLEGAL (code 8309). This is an enum-style whitelist check on the parameter's source type.
Solutions
- Set "from" to one of the allowed values 0, 1, or 2 in the request payload
- Update the client/UI to default the source selector to a valid value instead of null
- Sync client enum definitions with the server's current from-value contract
Example fix
// before
{"paramName":"city","description":"City name","from":5}
// after
{"paramName":"city","description":"City name","from":0} Defensive patterns
Strategy: validation
Validate before calling
Integer from = payload.getFrom(); if (from == null || (from != 0 && from != 1 && from != 2)) { throw new IllegalArgumentException("from must be 0, 1 or 2"); } Type guard
boolean isValidFrom(Integer from) { return from != null && (from == 0 || from == 1 || from == 2); } Try / catch
try { toolboxApi.saveParam(payload); } catch (BusinessException e) { if (e.getCode() == 8309) { /* map to 400 with allowed values */ } else throw e; } Prevention
- Model 'from' as an enum (0/1/2) in client code instead of raw integers
- Default the source selector in the UI to a valid value
- Share a single enum definition between client and server
When it happens
Trigger: Submitting a tool parameter definition where the "from" field is missing (null) or set to a value outside {0,1,2}, e.g. 3, -1, or 100.
Common situations: Client code using stale or wrong enum constants after the source-type list changed; hand-written JSON payloads guessing the value; UI sending uninitialized dropdown state (null) when the user never picked a source.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/b3f5f3166ee2f203.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java:1628
validateFromValue(from);
}
boolean required = jsonObject.getBooleanValue("required");
JSONObject paramObject = createBaseParamObject(title, description, type);
if (input) {
addInputSpecificFields(paramObject, from, required, jsonObject);
}
targetObject.put(params, paramObject);
}
/**
* Validate from field value
*/
private void validateFromValue(Integer from) {
if (from == null || (from != 0 && from != 1 && from != 2)) {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_GET_SOURCE_ILLEGAL);
}
}
/**
* Create base parameter object
*/
private JSONObject createBaseParamObject(String title, String description, String type) {
JSONObject paramObject = new JSONObject();
paramObject.put("title", title);
paramObject.put("description", description);
paramObject.put("type", type);
return paramObject;
}
/**
* Add input specific fields
*/
private void addInputSpecificFields(JSONObject paramObject, Integer from, boolean required, JSONObject jsonObject) {View on GitHub (pinned to 5e758547a8)