paascloud/paascloud-master · warning · UacBizException
UAC10013009
UAC10013009
Error message
ErrorCodeEnum.UAC10013009
What it means
getActionTreeByRoleId throws UacBizException UAC10013009 when uacMenuService.listMenuListByRoleId(roleId) returns an empty list, meaning the role has no assigned menus, so no action tree can be built. It signals '该角色未分配菜单' (role has no menus assigned) semantics.
Solutions
- Assign menus to the role first (uacRoleMenuService / role-menu binding API) before requesting its action tree
- Treat UAC10013009 as 'empty tree' and show an empty state in the UI instead of an error
- Pre-seed default menu grants when creating roles programmatically
Example fix
// before
BindAuthVo vo = uacRoleService.getActionTreeByRoleId(roleId);
// after
try {
vo = uacRoleService.getActionTreeByRoleId(roleId);
} catch (UacBizException e) {
if ("UAC10013009".equals(e.getCode())) { vo = BindAuthVo.empty(); } else { throw e; }
} Defensive patterns
Strategy: try-catch
Validate before calling
List<UacMenu> menus = uacMenuService.listMenuListByRoleId(roleId);
if (PublicUtil.isEmpty(menus)) { /* show empty tree instead of calling */ } Type guard
boolean hasMenus = !uacMenuService.listMenuListByRoleId(roleId).isEmpty();
Try / catch
try { vo = service.getActionTreeByRoleId(roleId); } catch (UacBizException e) { if ("UAC10013009".equals(e.getCode())) { vo = BindAuthVo.empty(); } else { throw e; } } Prevention
- Assign default menus when creating roles
- Render an empty state for roles without menus instead of treating it as an error
When it happens
Trigger: Requesting the action tree for a freshly created role that has not yet been granted any menus, or after all its menus were unassigned.
Common situations: Opening the permission configuration page for a brand-new role; a cleanup job or earlier edit removed the role's menu grants.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/4642bdd80a9f6ae6.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java:270
}
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public BindAuthVo getActionTreeByRoleId(Long roleId) {
BindAuthVo bindAuthVo = new BindAuthVo();
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRole roleById = this.getRoleById(roleId);
if (roleById == null) {
logger.error("找不到角色信息 roleId={}", roleId);
throw new UacBizException(ErrorCodeEnum.UAC10012005, roleId);
}
List<UacMenu> uacMenus = uacMenuService.listMenuListByRoleId(roleId);
if (PublicUtil.isEmpty(uacMenus)) {
throw new UacBizException(ErrorCodeEnum.UAC10013009);
}
// 查询所有的权限信息
List<UacAction> uacActions = uacActionService.listActionList(uacMenus);
// 合并菜单和按钮权限 递归生成树结构
List<MenuVo> menuVoList = this.getAuthList(uacMenus, uacActions);
List<MenuVo> tree = TreeUtil.getChildMenuVos(menuVoList, 0L);
// 获取所有绑定的菜单和按钮权限Id集合
List<Long> checkedAuthList = uacActionService.getCheckedActionList(roleId);
bindAuthVo.setAuthTree(tree);
bindAuthVo.setCheckedAuthList(checkedAuthList);
return bindAuthVo;
}
View on GitHub (pinned to 781281a950)