apache/shenyu · error · ShenyuAdminException
registry is not exist
Error message
registry is not exist
What it means
Thrown by RegistryServiceImpl.update() when the incoming RegistryDTO is null or has no id, meaning there is no existing record to update. The admin layer rejects the update because an update operation must reference a persisted registry row.
Solutions
- Include the id of the existing registry row in the RegistryDTO when updating.
- Fetch the registry by registryId first and copy its id into the DTO before calling createOrUpdate.
- Verify the request payload field name is exactly "id" and it is populated before calling the API.
- If you intended a new registry, ensure the registryId does not already exist so the create path is used correctly.
Example fix
// before
RegistryDTO dto = new RegistryDTO();
dto.setRegistryId("zk-registry"); // id missing
registryService.createOrUpdate(dto);
// after
RegistryVO existing = registryService.findByRegistryId("zk-registry");
RegistryDTO dto = new RegistryDTO();
dto.setId(existing.getId());
dto.setRegistryId("zk-registry");
registryService.createOrUpdate(dto); Defensive patterns
Strategy: validation
Validate before calling
if (dto == null || dto.getId() == null) {
throw new IllegalArgumentException("RegistryDTO and its id are required for update");
} Try / catch
try {
registryService.createOrUpdate(dto);
} catch (ShenyuAdminException e) {
if ("registry is not exist".equals(e.getMessage())) { /* reload registry and set dto.id before retrying */ } else { throw e; }
} Prevention
- Never omit the id field when updating an existing registry.
- Verify payload serialization uses the exact field name 'id'.
- Fetch the record by registryId to obtain its id before editing.
- Ensure dashboard edit forms preserve the hidden id field on submit.
When it happens
Trigger: Calling createOrUpdate with a RegistryDTO whose id is null AND whose registryId already exists (create path threw previously? no — here dto==null or dto.getId()==null), so the code enters update() without a target row id.
Common situations: Client sends a JSON body that failed to deserialize into the id field (wrong field name like registryID), or API callers omit id when intending an update; dashboard edit form losing its hidden id field.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- registry_id is already exist
- uri validation of Condition failed, please check.
- parameter error
- unique index conflict, please enter again
- The user namespace rel is exist!
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/8e7dbecf9e03acd2.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/RegistryServiceImpl.java:113
.id(id)
.registryId(registryDTO.getRegistryId())
.protocol(registryDTO.getProtocol())
.address(registryDTO.getAddress())
.namespace(registryDTO.getNamespace())
.username(registryDTO.getUsername())
.password(registryDTO.getPassword())
.registryGroup(registryDTO.getGroup())
.dateCreated(currentTime)
.dateUpdated(currentTime)
.build();
registryMapper.insert(registryDO);
return RegistryTransfer.INSTANCE.mapToVo(registryDO);
}
private RegistryVO update(final RegistryDTO registryDTO) {
if (Objects.isNull(registryDTO) || Objects.isNull(registryDTO.getId())) {
throw new ShenyuAdminException("registry is not exist");
}
RegistryDO existRegistryDO = registryMapper.selectByRegistryId(registryDTO.getRegistryId());
if (Objects.nonNull(existRegistryDO) && !existRegistryDO.getId().equals(registryDTO.getId())) {
throw new ShenyuAdminException("registry_id is already exist");
}
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
RegistryDO registryDO = RegistryDO.builder()
.id(registryDTO.getId())
.registryId(registryDTO.getRegistryId())
.protocol(registryDTO.getProtocol())
.address(registryDTO.getAddress())
.namespace(registryDTO.getNamespace())
.username(registryDTO.getUsername())
.password(registryDTO.getPassword())
.registryGroup(registryDTO.getGroup())
.dateUpdated(currentTime)
.build();
return registryMapper.updateSelective(registryDO) > 0View on GitHub (pinned to 567142e072)