paascloud/paascloud-master · warning · UacBizException

UAC10013010

UAC10013010

Error message

选择菜单不是根目录,menuId=%s

What it means

UAC10013010 is thrown while saving a user's chosen common menus: for each menuId in menuIdList, uacMenuService.checkMenuHasChildMenu(menuId) returns true, meaning the selected menu is a parent/directory node, not a leaf. Only leaf menu items may be added to a user's common-menu list, so the save aborts with 'menuId=...'.

Solutions

  1. Filter out non-leaf menus on the client: only include menu IDs where checkMenuHasChildMenu(menuId) is false.
  2. Have the server skip or reject parent nodes gracefully instead of failing the whole batch.
  3. Refresh menu data on the client after any menu-structure change so stale leaf selections are dropped.
  4. Wrap the save call in a handler for UacBizException(UAC10013010) and prompt the user to reselect menus.

Example fix

// before
List<Long> menuIdList = request.getMenuIdList();
uacUserService.saveUserMenus(menuIdList);
// after
List<Long> leafIds = menuIdList.stream()
    .filter(id -> !uacMenuService.checkMenuHasChildMenu(id))
    .collect(Collectors.toList());
uacUserService.saveUserMenus(leafIds);
Defensive patterns

Strategy: validation

Validate before calling

List<Long> leafIds = menuIdList.stream()
    .filter(id -> !uacMenuService.checkMenuHasChildMenu(id))
    .collect(Collectors.toList());
if (leafIds.size() != menuIdList.size()) {
    return Result.fail("only leaf menus can be selected");
}

Try / catch

try {
    uacUserService.saveUserMenus(menuIdList);
} catch (UacBizException e) {
    if ("UAC10013010".equals(e.getCode())) { return Result.fail(400, "selected menu is a directory, reselect leaf items"); }
    throw e;
}

Prevention

When it happens

Trigger: Client sends a menu tree's parent/directory IDs in the menuIdList; the frontend fails to filter out folder nodes before submitting; menu data changed so a previously-leaf menu gained children.

Common situations: Older frontend versions submitting full tree selections; menu reorganization turning a formerly selectable item into a directory; API consumers constructing menuIdList manually from the menu table.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:929

		List<MenuVo> currentUserMenuVoList = uacMenuService.findAllMenuListByAuthResDto(authResDto);
		List<Long> currentUserMenuIdList = Lists.newArrayList();
		for (MenuVo menuVo : currentUserMenuVoList) {
			Long menuId = menuVo.getId();

			if (PublicUtil.isEmpty(menuId)) {
				continue;
			}
			currentUserMenuIdList.add(menuId);
		}

		Preconditions.checkArgument(currentUserMenuIdList.containsAll(menuIdList), "参数异常");

		// TODO 预留一个过滤已失效菜单的接口
		for (Long menuId : menuIdList) {
			if (uacMenuService.checkMenuHasChildMenu(menuId)) {
				logger.error(" 选择菜单不是根目录 menuId= {}", menuId);
				throw new UacBizException(ErrorCodeEnum.UAC10013010, menuId);
			}
			UacUserMenu uacUserMenu = new UacUserMenu();
			uacUserMenu.setUserId(authResDto.getUserId());
			uacUserMenu.setMenuId(menuId);
			uacUserMenuList.add(uacUserMenu);
		}
	}

	private int handleUserMenuList(List<UacUserMenu> uacUserMenuList, UacUserMenu uacUserMenu) {
		// 如果存在记录则清空数据表
		deleteUserMenuList(uacUserMenu);

		return uacUserMenuService.batchSave(uacUserMenuList);
	}

	private void validateRegisterInfo(UserRegisterDto registerDto) {
		String mobileNo = registerDto.getMobileNo();

View on GitHub (pinned to 781281a950)