iflytek/astron-agent · warning · BusinessException
DATABASE_NAME_NOT_EMPTY
DATABASE_NAME_NOT_EMPTY
Error message
DATABASE_NAME_NOT_EMPTY
What it means
Thrown by DatabaseService.create when the incoming DatabaseDto has a null, empty, or whitespace-only name. The service requires every new database record to carry a non-blank display name before it validates duplicates or calls the core system. It is a fail-fast input validation guard, not a system fault.
Solutions
- Set a non-blank name on DatabaseDto before calling create
- Add a required/not-blank validation on the frontend form for the name field
- Check the request payload actually contains the 'name' key (correct JSON field naming)
- If building DTO programmatically, default or reject null names at the call site
Example fix
// before
DatabaseDto dto = new DatabaseDto();
dto.setDescription("analytics");
databaseService.create(dto); // throws DATABASE_NAME_NOT_EMPTY
// after
DatabaseDto dto = new DatabaseDto();
dto.setName("analytics-db");
databaseService.create(dto); Defensive patterns
Strategy: validation
Validate before calling
if (dto == null || dto.getName() == null || dto.getName().isBlank()) {
throw new IllegalArgumentException("Database name is required");
}
databaseService.create(dto); Type guard
boolean hasName(DatabaseDto dto) { return dto != null && dto.getName() != null && !dto.getName().trim().isEmpty(); } Try / catch
try { databaseService.create(dto); } catch (BusinessException e) { if ("DATABASE_NAME_NOT_EMPTY".equals(e.getCode())) { /* prompt for name */ } else { throw e; } } Prevention
- Mark name as required in forms and API schemas
- Use @NotBlank on DatabaseDto.name for bean validation
- Unit test create with null/empty/whitespace names
When it happens
Trigger: Calling POST database-create (DatabaseService.create) with a DatabaseDto whose name field is null, "" or all whitespace.
Common situations: Frontend form submitted without filling the name field; API client omits 'name' in the JSON body; a script sends a DTO built from an optional field that defaulted to null; request deserialization silently drops the name key.
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/0d306a8d7399cb20.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java:107
@Autowired
private DSLContext dslCon;
@Autowired
private CommonConfig commonConfig;
@Autowired
private DbDialect dialect;
private static final String[] SYSTEM_FIELDS = {"id", "uid", "create_time"};
// New additions in DatabaseService
private static final int MAX_PAGE_SIZE = 1000; // Prevent explosion
private static final int MAX_EXPORT_IDS = 1000; // IN clause limit
@Transactional
public DbInfo create(DatabaseDto databaseDto) {
try {
// Required field validation
if (!StringUtils.isNotBlank(databaseDto.getName())) {
throw new BusinessException(ResponseEnum.DATABASE_NAME_NOT_EMPTY);
}
String userId = Objects.requireNonNull(UserInfoManagerHandler.getUserId()).toString();
Long spaceId = SpaceInfoUtil.getSpaceId();
// Duplicate name validation
Long count = 0L;
if (spaceId == null) {
count = dbInfoMapper.selectCount(new QueryWrapper<DbInfo>().lambda()
.eq(DbInfo::getName, databaseDto.getName())
.eq(DbInfo::getSpaceId, null)
.eq(DbInfo::getUid, userId)
.eq(DbInfo::getDeleted, false));
} else {
count = dbInfoMapper.selectCount(new QueryWrapper<DbInfo>().lambda()
.eq(DbInfo::getName, databaseDto.getName())
.eq(DbInfo::getUid, userId)
.eq(DbInfo::getSpaceId, spaceId)
.eq(DbInfo::getDeleted, false));
}View on GitHub (pinned to 5e758547a8)