{"record":{"id":"ad4041846e212cfa","repo":"paascloud/paascloud-master","slug":"uac10013003","errorCode":"UAC10013003","errorMessage":"菜单不存在,menuId=%s","messagePattern":"菜单不存在,menuId=(.+?)","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java","lineNumber":174,"sourceCode":"\t\t\tmenu.setLastOperator(loginAuthDto.getUserName());\n\t\t\t// 新增的菜单是叶子节点\n\t\t\tmenu.setLeaf(MenuConstant.MENU_LEAF_YES);\n\t\t\treturn uacMenuMapper.insertSelective(menu);\n\t\t} else {\n\t\t\treturn uacMenuMapper.updateByPrimaryKeySelective(menu);\n\t\t}\n\t}\n\n\t@Override\n\tpublic int deleteUacMenuById(Long id, LoginAuthDto loginAuthDto) {\n\t\tPreconditions.checkArgument(id != null, \"菜单id不能为空\");\n\t\tint result;\n\t\t// 获取当前菜单信息\n\t\tUacMenu uacMenuQuery = new UacMenu();\n\t\tuacMenuQuery.setId(id);\n\t\tuacMenuQuery = mapper.selectOne(uacMenuQuery);\n\t\tif (PublicUtil.isEmpty(uacMenuQuery)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10013003, id);\n\t\t}\n\n\t\t// 删除菜单与角色的关联关系\n\t\tUacRoleMenu uacRoleMenu = new UacRoleMenu();\n\t\tuacRoleMenu.setMenuId(id);\n\t\tuacRoleMenuService.delete(uacRoleMenu);\n\n\n\t\t// 删除菜单\n\t\tresult = uacMenuMapper.deleteByPrimaryKey(id);\n\t\tif (result < 1) {\n\t\t\tlogger.error(\"删除菜单失败 menuId={}\", id);\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10013008, id);\n\t\t}\n\n\t\t// 删除权限\n\t\t// TODO 应该先查询再删除\n\t\tuacActionService.deleteByMenuId(id);","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the menu exists first with the query API (getViewVoById or the menu list endpoint) using the same menuId.","Make delete idempotent on the caller side: treat 'menu not found' on delete as success and refresh the list.","Confirm you are pointed at the correct environment DB; menuIds differ across environments.","If the id should exist, inspect uac_menu directly to see if it was deleted by another process."],"exampleFix":"// before: blind delete\nuacMenuService.deleteUacMenuById(menuId);\n// after: guard for absence\nViewMenuVo vo;\ntry {\n  vo = uacMenuService.getViewVoById(menuId);\n} catch (UacBizException e) {\n  return; // already deleted, nothing to do\n}\nuacMenuService.deleteUacMenuById(menuId);","handlingStrategy":"try-catch","validationCode":"UacMenu menu = uacMenuMapper.selectByPrimaryKey(id);\nif (menu == null) { return; /* nothing to delete */ }","typeGuard":"boolean menuExists(Long id) { return id != null && uacMenuMapper.selectByPrimaryKey(id) != null; }","tryCatchPattern":"try {\n  uacMenuService.deleteUacMenuById(id);\n} catch (UacBizException e) {\n  if (\"UAC10013003\".equals(e.getCode())) { /* treat as already deleted; refresh list */ return; }\n  throw e;\n}","preventionTips":["Refresh the menu list after any delete so the UI never shows stale rows.","Disable delete buttons once a delete request is in flight to avoid double submits.","Treat not-found on delete as success for idempotency."],"tags":["menu-management","uac","not-found","delete"],"backgroundTag":"record-not-found","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}