{"record":{"id":"1c985d07e89f89a0","repo":"iflytek/astron-agent","slug":"invite-space-already-deleted","errorCode":"INVITE_SPACE_ALREADY_DELETED","errorMessage":"INVITE_SPACE_ALREADY_DELETED","messagePattern":"INVITE_SPACE_ALREADY_DELETED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/InviteRecordBizServiceImpl.java","lineNumber":426,"sourceCode":"        }\n        UserInfo inviterUser = userInfoDataService.findByUid(vo.getInviterUid()).orElseThrow();\n        vo.setInviterName(inviterUser.getNickname());\n        vo.setInviterAvatar(inviterUser.getAvatar());\n        if (Objects.equals(InviteRecordTypeEnum.SPACE.getCode(), vo.getType())) {\n            SpaceUser spaceOwner = spaceUserService.getSpaceOwner(vo.getSpaceId());\n            if (spaceOwner != null) {\n                UserInfo ownerUser = userInfoDataService.findByUid(spaceOwner.getUid()).orElseThrow();\n                vo.setOwnerName(ownerUser.getNickname());\n                vo.setOwnerAvatar(ownerUser.getAvatar());\n            }\n            Space space = spaceService.getSpaceById(vo.getSpaceId());\n            if (space != null) {\n                vo.setSpaceName(space.getName());\n                vo.setSpaceAvatar(space.getAvatarUrl());\n                vo.setSpaceDescription(space.getDescription());\n                vo.setIsBelong(spaceUserService.getSpaceUserByUid(vo.getSpaceId(), vo.getInviteeUid()) != null);\n            } else {\n                throw new BusinessException(ResponseEnum.INVITE_SPACE_ALREADY_DELETED);\n            }\n\n        } else if (Objects.equals(InviteRecordTypeEnum.ENTERPRISE.getCode(), vo.getType())) {\n            Enterprise enterprise = enterpriseService.getEnterpriseById(vo.getEnterpriseId());\n            vo.setEnterpriseName(enterprise.getName());\n            vo.setEnterpriseAvatar(enterprise.getAvatarUrl());\n            UserInfo ownerUser = userInfoDataService.findByUid(enterprise.getUid()).orElseThrow();\n            vo.setOwnerName(ownerUser.getNickname());\n            vo.setOwnerAvatar(ownerUser.getAvatar());\n            vo.setIsBelong(enterpriseUserService.getEnterpriseUserByUid(vo.getEnterpriseId(), vo.getInviteeUid()) != null);\n        }\n        return vo;\n    }\n\n    /**\n     * Get UIDs that have joined space/team\n     *\n     * @param type","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/InviteRecordBizServiceImpl.java#L408-L444","documentation":"INVITE_SPACE_ALREADY_DELETED is thrown by getRecordByParam when an invitation of type SPACE references a spaceId that no longer resolves to a Space entity. The invitation record is valid but the target space has been deleted, so the invitation cannot be fulfilled.","triggerScenarios":"Opening an invitation link for a space that was deleted (or hard-removed by admin/cleanup) after the invitation was created.","commonSituations":"User deletes a space while outstanding invite links are still circulating; bulk space cleanup jobs invalidating invites; cross-environment links pointing at a space that never existed there.","solutions":["Confirm in the database whether the space with vo.getSpaceId() still exists or was soft-deleted","Ask the space owner to recreate the space and issue a new invitation","Client-side: catch this code and show 'the space you were invited to no longer exists' with guidance to request a new invite","Consider soft-deleting/outdating invitations when a space is deleted to prevent this at read time"],"exampleFix":"// before\n} else {\n    throw new BusinessException(ResponseEnum.INVITE_SPACE_ALREADY_DELETED);\n}\n// after\n} else {\n    log.warn(\"Invite {} points to deleted space {}\", vo.getId(), vo.getSpaceId());\n    inviteRecordService.invalidate(vo.getId());\n    throw new BusinessException(ResponseEnum.INVITE_SPACE_ALREADY_DELETED);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    InviteRecordVO vo = inviteRecordBizService.getRecordByParam(param);\n} catch (BusinessException e) {\n    if (ResponseEnum.INVITE_SPACE_ALREADY_DELETED.getCode().equals(e.getCode())) {\n        return renderSpaceDeletedPage(vo.getSpaceName());\n    }\n    throw e;\n}","preventionTips":["Invalidate outstanding invitations when a space is deleted (cascade hook)","Prefer soft-delete for spaces so links can degrade gracefully","Show space status in admin UI so owners see pending invites before deleting"],"tags":["java","invitation","space-deleted","stale-reference"],"backgroundTag":"entity-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}