iflytek/astron-agent · error · BusinessException
8322
8322
Error message
toolbox.name.empty
What it means
TOOLBOX_NAME_EMPTY (code 8322) thrown by ToolBoxController.createTool when the request body's name field is null. The controller performs null checks on name and description before calling toolBoxService.createTool. Note the same enum is reused for a missing description, so 'toolbox.name.empty' can actually mean either field is missing.
Solutions
- Include both name and description (non-null) in the create-tool request body.
- Add required-field checks client-side before submitting the form.
- Server-side, distinguish the two failures: throw TOOLBOX_NAME_EMPTY for name and a dedicated TOOLBOX_DESCRIPTION_EMPTY enum for description.
- Add @NotBlank bean-validation annotations on ToolBoxDto so Spring returns a 400 with field-level messages.
Example fix
// before
{"description": "my plugin"}
// after
{"name": "my-plugin", "description": "my plugin"} Defensive patterns
Strategy: validation
Validate before calling
function canCreateTool(dto) {
return dto != null && dto.name != null && dto.description != null;
} Type guard
const hasName = (dto) => typeof dto?.name === 'string' && dto.name.trim().length > 0;
Try / catch
try {
await api.createTool(dto);
} catch (e) {
if (e.code === 8322) {
form.name.$error = !dto.name;
form.description.$error = !dto.description;
} else throw e;
} Prevention
- Mark both name and description as required in the create form.
- Block submit until required fields pass validation.
- Add @NotBlank on ToolBoxDto.name/description for server-side bean validation.
- Don't send objects with null keys stripped — validate before serialization.
When it happens
Trigger: POST /create-tool with a JSON body lacking the name field (e.g. {"description":"my plugin"}) — or, per line 37, lacking the description field.
Common situations: Frontend form submitted before the name input is filled; client builds the DTO dynamically and omits null keys; renamed API fields after a version change so the client still sends an old field name.
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/1d7420240f125a56.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/tool/ToolBoxController.java:34
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/tool")
@Slf4j
@ResponseResultBody
@Tag(name = "Plugin Management")
public class ToolBoxController {
@Resource
ToolBoxService toolBoxService;
@PostMapping("/create-tool")
@Operation(summary = "Create plugin")
@SpacePreAuth(key = "ToolBoxController_createTool_POST")
public Object createTool(@RequestBody ToolBoxDto toolBoxDto) {
if (toolBoxDto.getName() == null) {
throw new BusinessException(ResponseEnum.TOOLBOX_NAME_EMPTY);
}
if (toolBoxDto.getDescription() == null) {
throw new BusinessException(ResponseEnum.TOOLBOX_NAME_EMPTY);
}
return toolBoxService.createTool(toolBoxDto);
}
@PostMapping("/temporary-tool")
@Operation(summary = "Temporarily save plugin")
@SpacePreAuth(key = "ToolBoxController_temporaryTool_POST")
public Object temporaryTool(@RequestBody ToolBoxDto toolBoxDto) {
if (toolBoxDto.getName() == null) {
throw new BusinessException(ResponseEnum.TOOLBOX_NAME_EMPTY);
}
return toolBoxService.temporaryTool(toolBoxDto);
}
@PutMapping("/update-tool")View on GitHub (pinned to 5e758547a8)