{"record":{"id":"b884d07d1f543871","repo":"iflytek/astron-agent","slug":"invite-unsupported-type","errorCode":"INVITE_UNSUPPORTED_TYPE","errorMessage":"INVITE_UNSUPPORTED_TYPE","messagePattern":"INVITE_UNSUPPORTED_TYPE","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/InviteRecordBizServiceImpl.java","lineNumber":281,"sourceCode":"                    Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? EnterpriseRoleEnum.GOVERNOR : EnterpriseRoleEnum.STAFF)) {\n                throw new BusinessException(ResponseEnum.INVITE_ADD_TEAM_USER_FAILED);\n            }\n            // Add space user\n        } else if (InviteRecordTypeEnum.SPACE.getCode().equals(inviteRecord.getType())) {\n            if (!spaceUserService.addSpaceUser(inviteRecord.getSpaceId(), inviteRecord.getInviteeUid(),\n                    Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? SpaceRoleEnum.ADMIN : SpaceRoleEnum.MEMBER)) {\n                throw new BusinessException(ResponseEnum.SPACE_USER_ADD_FAILED);\n            }\n            Space space = spaceService.getSpaceById(inviteRecord.getSpaceId());\n            // For enterprise space invitation, if not joined team, add user\n            if (space.getEnterpriseId() != null) {\n                if (!enterpriseUserService.addEnterpriseUser(space.getEnterpriseId(), inviteRecord.getInviteeUid(),\n                        Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? EnterpriseRoleEnum.GOVERNOR : EnterpriseRoleEnum.STAFF)) {\n                    throw new BusinessException(ResponseEnum.INVITE_ADD_TEAM_USER_FAILED);\n                }\n            }\n        } else {\n            throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);\n        }\n        return ApiResult.success();\n    }\n\n    /**\n     * Decline invitation\n     *\n     * @param inviteId\n     * @return\n     */\n    @Override\n    @Transactional\n    public ApiResult<String> refuseInvite(Long inviteId) {\n        InviteRecord inviteRecord = inviteRecordService.getById(inviteId);\n        ApiResult<String> responseMsg = checkInviteRecord(inviteRecord);\n        if (responseMsg != null) {\n            return responseMsg;\n        }","sourceCodeStart":263,"sourceCodeEnd":299,"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#L263-L299","documentation":"INVITE_UNSUPPORTED_TYPE is thrown by acceptInvite when the invite record's type matches neither InviteRecordTypeEnum.ENTERPRISE nor InviteRecordTypeEnum.SPACE. The invitation record is corrupt or of an unknown/newer type, so it cannot be accepted.","triggerScenarios":"acceptInvite called with an inviteRecord whose type code is not ENTERPRISE or SPACE — e.g. null/garbage type, a legacy record, or a record written by a newer version with an unhandled type.","commonSituations":"Corrupted invite rows after schema changes; hand-crafted invite IDs; forward-compatibility issues after adding new invite types; tests seeding invalid type codes.","solutions":["Inspect the invite record's type in the DB and correct or delete it","Re-create the invitation so a valid type is written","Add the new type to InviteRecordTypeEnum and handle it in acceptInvite if it's legitimate"],"exampleFix":"// before\n} else {\n    throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);\n}\n// after\n} else if (InviteRecordTypeEnum.NEW_TYPE.getCode().equals(inviteRecord.getType())) {\n    handleNewType(inviteRecord);\n} else {\n    throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);\n}","handlingStrategy":"validation","validationCode":"Integer type = inviteRecord.getType(); boolean known = InviteRecordTypeEnum.ENTERPRISE.getCode().equals(type) || InviteRecordTypeEnum.SPACE.getCode().equals(type); if (!known) { /* abort: unsupported invite type */ }","typeGuard":"boolean isSupportedInvite(Integer type) { return InviteRecordTypeEnum.ENTERPRISE.getCode().equals(type) || InviteRecordTypeEnum.SPACE.getCode().equals(type); }","tryCatchPattern":"try { acceptInvite(inviteId); } catch (BusinessException e) { if (\"INVITE_UNSUPPORTED_TYPE\".equals(e.getMessage())) { /* surface 'unsupported invitation' and inspect record type */ } }","preventionTips":["Constrain the invite record type column to known enum values in the DB","Extend InviteRecordTypeEnum and acceptInvite together when adding types","Validate invite records at creation time, not only at acceptance"],"tags":["invite","enum","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}