{"record":{"id":"aded012f35101a60","repo":"iflytek/astron-agent","slug":"invite-parameter-exception","errorCode":"INVITE_PARAMETER_EXCEPTION","errorMessage":"INVITE_PARAMETER_EXCEPTION","messagePattern":"INVITE_PARAMETER_EXCEPTION","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":403,"sourceCode":"    }\n\n\n    /**\n     * Get invitation record by parameter\n     *\n     * @param param Invitation record ID AES encrypted\n     * @return\n     */\n    @Override\n    public InviteRecordVO getRecordByParam(String param) {\n        long id = 0;\n        try {\n            String decrypt = AESUtil.decrypt(param, AES_KEY);\n            assert decrypt != null;\n            id = Long.parseLong(decrypt);\n        } catch (Exception e) {\n            log.error(\"Failed to parse invitation parameters\", e);\n            throw new BusinessException(ResponseEnum.INVITE_PARAMETER_EXCEPTION);\n        }\n        InviteRecordVO vo = inviteRecordService.selectVOById(id);\n        if (vo == null) {\n            throw new BusinessException(ResponseEnum.INVITE_RECORD_NOT_FOUND);\n        }\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());","sourceCodeStart":385,"sourceCodeEnd":421,"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#L385-L421","documentation":"INVITE_PARAMETER_EXCEPTION is thrown by InviteRecordBizServiceImpl.getRecordByParam when the encrypted invitation 'param' cannot be decrypted with AES_KEY or the decrypted plaintext cannot be parsed as a Long id. It means the invitation link parameter is invalid, corrupted, or was encrypted with a different key. The service deliberately collapses all decrypt/parse failures into this single business error.","triggerScenarios":"Calling getRecordByParam with a param that is null, truncated (e.g. URL-decoding stripped characters like '+' becoming space), tampered with, or encrypted with a different AES key than AES_KEY; or a param whose decryption does not yield a numeric Long.","commonSituations":"Invitation links opened after the server's AES_KEY was rotated or differs across environments (staging link hit against prod); email/IM clients mangling the base64 ciphertext (line wraps, '+' to space in query strings); users truncating the link when copying; forwarding links between environments.","solutions":["URL-encode the encrypted param when building invitation links and URL-decode it at the entry point so '+' and '/' survive transport","Verify AES_KEY is identical across all nodes/environments generating and consuming invitation links","Validate the param on the client before calling (non-empty, expected charset/length) and show 'invalid invitation link' instead of hitting the API","Regenerate the invitation link if it predates a key rotation; old links cannot be recovered"],"exampleFix":"// before\nString decrypt = AESUtil.decrypt(param, AES_KEY);\nassert decrypt != null;\nid = Long.parseLong(decrypt);\n// after\nString decrypt = AESUtil.decrypt(URLDecoder.decode(param, StandardCharsets.UTF_8), AES_KEY);\nif (decrypt == null || !decrypt.chars().allMatch(Character::isDigit)) {\n    throw new BusinessException(ResponseEnum.INVITE_PARAMETER_EXCEPTION);\n}\nid = Long.parseLong(decrypt);","handlingStrategy":"validation","validationCode":"// client-side pre-check before calling the API\nfunction canCallGetRecord(param) {\n  return typeof param === 'string' && param.length > 0 && /^[A-Za-z0-9+/=_-]+$/.test(param);\n}","typeGuard":null,"tryCatchPattern":"// server-side callers\ntry {\n    InviteRecordVO vo = inviteRecordBizService.getRecordByParam(param);\n} catch (BusinessException e) {\n    if (ResponseEnum.INVITE_PARAMETER_EXCEPTION.getCode().equals(e.getCode())) {\n        throw new BusinessException(ResponseEnum.INVITE_PARAMETER_EXCEPTION); // render 'invalid invitation link'\n    }\n    throw e;\n}","preventionTips":["Always URL-encode the encrypted param in links and decode on receipt","Keep AES_KEY synchronized across environments and document rotations (old links die)","Never build invitation params by hand; use the shared encrypt utility","Validate param shape client-side before the API call"],"tags":["java","invitation","aes-decryption","invalid-input"],"backgroundTag":"invalid-argument-format","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"}