iflytek/astron-agent · error · BusinessException
8307
8307
Error message
toolbox.param.cannot.empty
What it means
Thrown by ToolBoxService.validateParamBasicInfo when a parameter definition is missing its "type" (first check) or, when previewType == 0, the "title"/display name is empty. Both conditions surface the same TOOLBOX_PARAM_CANNOT_EMPTY error, enforcing that every parameter has at least a type and a title.
Solutions
- Fill in the parameter "type" (and, for real saves, the "title") for every parameter entry before submitting.
- Add client-side required-field validation on the parameter form (type and name are mandatory).
- If this occurs during preview-only flows, verify previewType is set correctly — the title is only required when previewType == 0.
- Filter out blank/placeholder parameter rows generated by the UI before sending the schema.
Example fix
// before
{"title": "timeout", "type": ""}
// after
{"title": "timeout", "type": "NUMBER"} Defensive patterns
Strategy: validation
Validate before calling
for (JSONObject p : paramArray) {
boolean missingType = p.getString("type") == null || p.getString("type").isBlank();
boolean missingTitle = previewType == 0 && (p.getString("title") == null || p.getString("title").isBlank());
if (missingType || missingTitle) throw new IllegalArgumentException("Parameter needs a type" + (previewType == 0 ? " and a title" : ""));
} Type guard
boolean hasBasicInfo(JSONObject p, int previewType) {
String t = p.getString("type"), title = p.getString("title");
boolean typeOk = t != null && !t.isBlank();
boolean titleOk = previewType != 0 || (title != null && !title.isBlank());
return typeOk && titleOk;
} Try / catch
try {
toolBoxService.saveToolSchema(paramArray);
} catch (BusinessException e) {
if ("TOOLBOX_PARAM_CANNOT_EMPTY".equals(String.valueOf(e.getCode()))) {
// highlight the first parameter row with an empty type (or title when saving)
}
} Prevention
- Mark type and name fields required in the parameter editor UI.
- Drop empty auto-added parameter rows before submit.
- Pass previewType correctly — title is only mandatory for real saves (previewType == 0).
When it happens
Trigger: Saving a tool with a parameter entry lacking the "type" key, or submitting for non-preview (previewType == 0, i.e. real save) a parameter whose "title" field is empty — both throw code 8307.
Common situations: Frontend form allowing 'add parameter' with blank fields; dynamically generated parameter rows where the user skipped the name; programmatic schema generation producing entries with null fields.
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/9b907350b67e5fe6.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java:1574
String title = jsonObject.getString("paramName");
String description = jsonObject.getString("description");
if (isSimpleType(type)) {
processSimpleTypeParam(jsonObject, targetObject, params, title, description, type, input);
} else if (isComplexType(type)) {
processComplexTypeParam(jsonObject, targetObject, previewType, params, title, description, type, input);
} else {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_TYPE_NOT_MATCH);
}
}
/**
* Validate parameter basic information
*/
private void validateParamBasicInfo(JSONObject jsonObject, Integer previewType) {
String type = jsonObject.getString("type");
if (StringUtils.isEmpty(type)) {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);
}
String params = jsonObject.getString("title");
if (previewType == 0 && StringUtils.isEmpty(params)) {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);
}
String title = jsonObject.getString("paramName");
String description = jsonObject.getString("description");
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(description)) {
throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_AND_DESC_CANNOT_EMPTY);
}
}
/**
* Determine if it is a simple type
*/
private boolean isSimpleType(String type) {View on GitHub (pinned to 5e758547a8)