iflytek/astron-agent · error · BusinessException
8306
8306
Error message
toolbox.param.type.cannot.empty
What it means
Thrown by ToolBoxService during parameter-array processing when a parameter definition object has an empty or missing "type" field. Every parameter entry in the tool's parameter schema must declare one of the supported types (STRING/NUMBER/BOOLEAN, or complex types) so the service knows how to coerce defaults and validate inputs.
Solutions
- Add a valid "type" value (STRING, NUMBER, BOOLEAN, or an allowed complex type) to every entry in the parameter array.
- Fix the producing code/form so the type dropdown cannot be left empty before submit.
- Add a client-side check: fail fast if any parameter definition lacks a non-empty type.
- Re-import the tool definition from a known-good template.
Example fix
// before
{"title": "timeout", "default": 30}
// after
{"title": "timeout", "type": "NUMBER", "default": 30} Defensive patterns
Strategy: validation
Validate before calling
for (JSONObject p : paramArray) {
if (p == null || p.getString("type") == null || p.getString("type").isBlank()) {
throw new IllegalArgumentException("Every parameter definition requires a non-empty 'type'");
}
} Type guard
boolean hasType(JSONObject p) {
return p != null && p.getString("type") != null && !p.getString("type").isBlank();
} Try / catch
try {
toolBoxService.saveToolSchema(paramArray);
} catch (BusinessException e) {
if ("TOOLBOX_PARAM_TYPE_CANNOT_EMPTY".equals(String.valueOf(e.getCode()))) {
// point user to the parameter entry missing 'type'
}
} Prevention
- Enforce the type dropdown as a required field in the parameter form.
- Validate tool-definition JSON against a schema before import/save.
- Never hand-edit tool JSON without re-validating types afterwards.
When it happens
Trigger: Saving or importing a tool definition whose parameterArray contains an entry without a "type" key (or with an empty string), e.g. a hand-edited JSON schema or a tool created via API omitting the type field.
Common situations: Hand-authored JSON/YAML tool definitions missing a field; migration scripts that copy parameter objects but drop "type"; frontend form that allows saving with an unselected type dropdown.
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/781aef03dcf29fd3.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java:1485
retObject.put("toolHttpHeaders", toolHttpHeadersTarget);
JSONArray toolRequestBody = webSchemaObject.getJSONArray("toolRequestBody");
JSONObject toolRequestBodyTarget = new JSONObject();
convertRequestParams(toolRequestBody, toolRequestBodyTarget);
retObject.put("toolRequestBody", toolRequestBodyTarget);
return retObject;
}
private void convertRequestParams(JSONArray paramArray, JSONObject targetObject) {
if (CollectionUtils.isEmpty(paramArray)) {
return;
}
for (int i = 0; i < paramArray.size(); i++) {
JSONObject jsonObject = paramArray.getJSONObject(i);
String type = jsonObject.getString("type");
if (StringUtils.isEmpty(type)) {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_TYPE_CANNOT_EMPTY);
}
String params = jsonObject.getString("title");
if (STRING.equals(type) || NUMBER.equals(type) || BOOLEAN.equals(type)) {// Single attribute
Object defaultValue = jsonObject.get("default");
targetObject.put(params, defaultValue);
} else if (OBJECT.equals(type) || ARRAY.equals(type)) {// Composite attribute object array
JSONArray jsonArray = jsonObject.getJSONArray("children");
if (OBJECT.equals(type)) {
JSONObject prop = new JSONObject();
targetObject.put(params, prop);
convertRequestParams(jsonArray, prop);
}
}
}
}
View on GitHub (pinned to 5e758547a8)