iflytek/astron-agent · error · BusinessException

INVITE_UNSUPPORTED_TYPE

INVITE_UNSUPPORTED_TYPE

Error message

INVITE_UNSUPPORTED_TYPE

What it means

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.

Solutions

  1. Inspect the invite record's type in the DB and correct or delete it
  2. Re-create the invitation so a valid type is written
  3. Add the new type to InviteRecordTypeEnum and handle it in acceptInvite if it's legitimate

Example fix

// before
} else {
    throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);
}
// after
} else if (InviteRecordTypeEnum.NEW_TYPE.getCode().equals(inviteRecord.getType())) {
    handleNewType(inviteRecord);
} else {
    throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);
}
Defensive patterns

Strategy: validation

Validate before calling

Integer type = inviteRecord.getType(); boolean known = InviteRecordTypeEnum.ENTERPRISE.getCode().equals(type) || InviteRecordTypeEnum.SPACE.getCode().equals(type); if (!known) { /* abort: unsupported invite type */ }

Type guard

boolean isSupportedInvite(Integer type) { return InviteRecordTypeEnum.ENTERPRISE.getCode().equals(type) || InviteRecordTypeEnum.SPACE.getCode().equals(type); }

Try / catch

try { acceptInvite(inviteId); } catch (BusinessException e) { if ("INVITE_UNSUPPORTED_TYPE".equals(e.getMessage())) { /* surface 'unsupported invitation' and inspect record type */ } }

Prevention

When it happens

Trigger: 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.

Common situations: Corrupted invite rows after schema changes; hand-crafted invite IDs; forward-compatibility issues after adding new invite types; tests seeding invalid type codes.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/b884d07d1f543871. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/InviteRecordBizServiceImpl.java:281

                    Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? EnterpriseRoleEnum.GOVERNOR : EnterpriseRoleEnum.STAFF)) {
                throw new BusinessException(ResponseEnum.INVITE_ADD_TEAM_USER_FAILED);
            }
            // Add space user
        } else if (InviteRecordTypeEnum.SPACE.getCode().equals(inviteRecord.getType())) {
            if (!spaceUserService.addSpaceUser(inviteRecord.getSpaceId(), inviteRecord.getInviteeUid(),
                    Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? SpaceRoleEnum.ADMIN : SpaceRoleEnum.MEMBER)) {
                throw new BusinessException(ResponseEnum.SPACE_USER_ADD_FAILED);
            }
            Space space = spaceService.getSpaceById(inviteRecord.getSpaceId());
            // For enterprise space invitation, if not joined team, add user
            if (space.getEnterpriseId() != null) {
                if (!enterpriseUserService.addEnterpriseUser(space.getEnterpriseId(), inviteRecord.getInviteeUid(),
                        Objects.equals(InviteRecordRoleEnum.ADMIN.getCode(), inviteRecord.getRole()) ? EnterpriseRoleEnum.GOVERNOR : EnterpriseRoleEnum.STAFF)) {
                    throw new BusinessException(ResponseEnum.INVITE_ADD_TEAM_USER_FAILED);
                }
            }
        } else {
            throw new BusinessException(ResponseEnum.INVITE_UNSUPPORTED_TYPE);
        }
        return ApiResult.success();
    }

    /**
     * Decline invitation
     *
     * @param inviteId
     * @return
     */
    @Override
    @Transactional
    public ApiResult<String> refuseInvite(Long inviteId) {
        InviteRecord inviteRecord = inviteRecordService.getById(inviteId);
        ApiResult<String> responseMsg = checkInviteRecord(inviteRecord);
        if (responseMsg != null) {
            return responseMsg;
        }

View on GitHub (pinned to 5e758547a8)