paascloud/paascloud-master · error · UacBizException

UAC10013003

UAC10013003

Error message

菜单不存在,menuId=%s

What it means

UacBizException UAC10013003 thrown when deleteUacMenuById cannot find a menu with the given id. The service queries uac_menu by id via mapper.selectOne and, if empty, throws before deleting role-menu associations. The message contains the missing menuId.

Solutions

  1. Check the menu exists first with the query API (getViewVoById or the menu list endpoint) using the same menuId.
  2. Make delete idempotent on the caller side: treat 'menu not found' on delete as success and refresh the list.
  3. Confirm you are pointed at the correct environment DB; menuIds differ across environments.
  4. If the id should exist, inspect uac_menu directly to see if it was deleted by another process.

Example fix

// before: blind delete
uacMenuService.deleteUacMenuById(menuId);
// after: guard for absence
ViewMenuVo vo;
try {
  vo = uacMenuService.getViewVoById(menuId);
} catch (UacBizException e) {
  return; // already deleted, nothing to do
}
uacMenuService.deleteUacMenuById(menuId);
Defensive patterns

Strategy: try-catch

Validate before calling

UacMenu menu = uacMenuMapper.selectByPrimaryKey(id);
if (menu == null) { return; /* nothing to delete */ }

Type guard

boolean menuExists(Long id) { return id != null && uacMenuMapper.selectByPrimaryKey(id) != null; }

Try / catch

try {
  uacMenuService.deleteUacMenuById(id);
} catch (UacBizException e) {
  if ("UAC10013003".equals(e.getCode())) { /* treat as already deleted; refresh list */ return; }
  throw e;
}

Prevention

When it happens

Trigger: Calling deleteUacMenuById(id) (or the REST endpoint /uac/menu/deleteUacMenuById) with an id that has no row in uac_menu — e.g. already deleted, wrong environment DB, or a fabricated id from the client.

Common situations: Double-click on a delete button firing the request twice; stale browser tab with a menu list rendered before another admin deleted the entry; copy-pasted menuId from another environment.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/ad4041846e212cfa. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java:174

			menu.setLastOperator(loginAuthDto.getUserName());
			// 新增的菜单是叶子节点
			menu.setLeaf(MenuConstant.MENU_LEAF_YES);
			return uacMenuMapper.insertSelective(menu);
		} else {
			return uacMenuMapper.updateByPrimaryKeySelective(menu);
		}
	}

	@Override
	public int deleteUacMenuById(Long id, LoginAuthDto loginAuthDto) {
		Preconditions.checkArgument(id != null, "菜单id不能为空");
		int result;
		// 获取当前菜单信息
		UacMenu uacMenuQuery = new UacMenu();
		uacMenuQuery.setId(id);
		uacMenuQuery = mapper.selectOne(uacMenuQuery);
		if (PublicUtil.isEmpty(uacMenuQuery)) {
			throw new UacBizException(ErrorCodeEnum.UAC10013003, id);
		}

		// 删除菜单与角色的关联关系
		UacRoleMenu uacRoleMenu = new UacRoleMenu();
		uacRoleMenu.setMenuId(id);
		uacRoleMenuService.delete(uacRoleMenu);


		// 删除菜单
		result = uacMenuMapper.deleteByPrimaryKey(id);
		if (result < 1) {
			logger.error("删除菜单失败 menuId={}", id);
			throw new UacBizException(ErrorCodeEnum.UAC10013008, id);
		}

		// 删除权限
		// TODO 应该先查询再删除
		uacActionService.deleteByMenuId(id);

View on GitHub (pinned to 781281a950)