{"record":{"id":"8e7dbecf9e03acd2","repo":"apache/shenyu","slug":"registry-is-not-exist","errorCode":null,"errorMessage":"registry is not exist","messagePattern":"registry is not exist","errorType":"exception","errorClass":"ShenyuAdminException","httpStatus":null,"severity":"error","filePath":"shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/RegistryServiceImpl.java","lineNumber":113,"sourceCode":"                .id(id)\n                .registryId(registryDTO.getRegistryId())\n                .protocol(registryDTO.getProtocol())\n                .address(registryDTO.getAddress())\n                .namespace(registryDTO.getNamespace())\n                .username(registryDTO.getUsername())\n                .password(registryDTO.getPassword())\n                .registryGroup(registryDTO.getGroup())\n                .dateCreated(currentTime)\n                .dateUpdated(currentTime)\n                .build();\n        registryMapper.insert(registryDO);\n\n        return RegistryTransfer.INSTANCE.mapToVo(registryDO);\n    }\n\n    private RegistryVO update(final RegistryDTO registryDTO) {\n        if (Objects.isNull(registryDTO) || Objects.isNull(registryDTO.getId())) {\n            throw new ShenyuAdminException(\"registry is not exist\");\n        }\n        RegistryDO existRegistryDO = registryMapper.selectByRegistryId(registryDTO.getRegistryId());\n        if (Objects.nonNull(existRegistryDO) && !existRegistryDO.getId().equals(registryDTO.getId())) {\n            throw new ShenyuAdminException(\"registry_id is already exist\");\n        }\n        Timestamp currentTime = new Timestamp(System.currentTimeMillis());\n        RegistryDO registryDO = RegistryDO.builder()\n                .id(registryDTO.getId())\n                .registryId(registryDTO.getRegistryId())\n                .protocol(registryDTO.getProtocol())\n                .address(registryDTO.getAddress())\n                .namespace(registryDTO.getNamespace())\n                .username(registryDTO.getUsername())\n                .password(registryDTO.getPassword())\n                .registryGroup(registryDTO.getGroup())\n                .dateUpdated(currentTime)\n                .build();\n        return registryMapper.updateSelective(registryDO) > 0","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/RegistryServiceImpl.java#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nRegistryDTO dto = new RegistryDTO();\ndto.setRegistryId(\"zk-registry\"); // id missing\nregistryService.createOrUpdate(dto);\n\n// after\nRegistryVO existing = registryService.findByRegistryId(\"zk-registry\");\nRegistryDTO dto = new RegistryDTO();\ndto.setId(existing.getId());\ndto.setRegistryId(\"zk-registry\");\nregistryService.createOrUpdate(dto);","handlingStrategy":"validation","validationCode":"if (dto == null || dto.getId() == null) {\n    throw new IllegalArgumentException(\"RegistryDTO and its id are required for update\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    registryService.createOrUpdate(dto);\n} catch (ShenyuAdminException e) {\n    if (\"registry is not exist\".equals(e.getMessage())) { /* reload registry and set dto.id before retrying */ } else { throw e; }\n}","preventionTips":["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."],"tags":["missing-id","update","admin-api","registry"],"backgroundTag":"entity-not-found","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}