{"record":{"id":"eb3d76fbcda9aef0","repo":"siyuan-note/siyuan","slug":"you-have-already-used-a-free-trial-subscription-d","errorCode":null,"errorMessage":"You have already used a free trial subscription. Duplicate trial subscriptions are not supported.","messagePattern":"You have already used a free trial subscription\\. Duplicate trial subscriptions are not supported\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/cloud_service.go","lineNumber":122,"sourceCode":"\t\treturn errors.New(Conf.Language(31))\n\t}\n\n\trequestResult := gulu.Ret.NewResult()\n\trequest := httpclient.NewCloudRequest30s()\n\tresp, err := request.\n\t\tSetSuccessResult(requestResult).\n\t\tSetCookies(&http.Cookie{Name: \"symphony\", Value: Conf.GetUser().UserToken}).\n\t\tPost(util.GetCloudServer() + \"/apis/siyuan/user/startFreeTrial\")\n\tif err != nil {\n\t\tlogging.LogErrorf(\"start free trial failed: %s\", err)\n\t\treturn ErrFailedToConnectCloudServer\n\t}\n\tif http.StatusOK != resp.StatusCode {\n\t\tlogging.LogErrorf(\"start free trial failed: %d\", resp.StatusCode)\n\t\treturn ErrFailedToConnectCloudServer\n\t}\n\tif -2 == requestResult.Code { // 已经试用订阅过\n\t\treturn errors.New(Conf.Language(298))\n\t}\n\tif 0 != requestResult.Code {\n\t\treturn errors.New(requestResult.Msg)\n\t}\n\treturn\n}\n\nfunc DeactivateUser() (err error) {\n\trequestResult := gulu.Ret.NewResult()\n\trequest := httpclient.NewCloudRequest30s()\n\tresp, err := request.\n\t\tSetSuccessResult(requestResult).\n\t\tSetCookies(&http.Cookie{Name: \"symphony\", Value: Conf.GetUser().UserToken}).\n\t\tPost(util.GetCloudServer() + \"/apis/siyuan/user/deactivate\")\n\tif err != nil {\n\t\tlogging.LogErrorf(\"deactivate user failed: %s\", err)\n\t\treturn ErrFailedToConnectCloudServer\n\t}","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/cloud_service.go#L104-L140","documentation":"In StartFreeTrial, returned when the cloud server responds with requestResult.Code == -2, the documented code for 'this account has already used a free trial subscription'. Conf.Language(298) resolves to 'You have already used a free trial subscription. Duplicate trial subscriptions are not supported.' This is a one-time-per-account business rule enforced server-side.","triggerScenarios":"The user already activated a free trial on this account in the past and attempts to start another. The server returns Code -2 specifically for this condition, distinct from other non-zero codes.","commonSituations":"User forgot they previously trialed; account shared across devices where trial was consumed elsewhere; testing environment reusing a real account that already trialed.","solutions":["Inform the user that the free trial is one-time-only and cannot be renewed.","Offer a paid subscription as the alternative path.","Use a fresh account only if a legitimate new trial is intended (not to circumvent the rule)."],"exampleFix":"// before\nerr := StartFreeTrial()\nif err != nil { showGenericError(err) }\n\n// after\nerr := StartFreeTrial()\nif err != nil && strings.Contains(err.Error(), Conf.Language(298)) {\n    showTrialAlreadyUsedHelp()\n} else if err != nil { showError(err) }","handlingStrategy":"validation","validationCode":"// Track prior trial use locally to avoid a redundant round trip\nif userAlreadyTriedTrial() { showTrialAlreadyUsedHelp(); return }","typeGuard":"func isTrialAlreadyUsed(err error) bool {\n    return err != nil && strings.Contains(err.Error(), model.Conf.Language(298))\n}","tryCatchPattern":"if err := model.StartFreeTrial(); err != nil {\n    if isTrialAlreadyUsed(err) { showUpgradePrompt() } else { showError(err) }\n}","preventionTips":["Cache the 'trial used' state locally after the first -2 response to avoid repeat attempts.","Offer a paid subscription as the fallback when the trial was already consumed.","Do not attempt to bypass the one-trial-per-account rule with multiple logins."],"tags":["cloud","subscription","business-rule","trial","cloud-service"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}