{"record":{"id":"0fdbcf10bc731860","repo":"theonedev/onedev","slug":"this-operation-requires-active-subscription","errorCode":null,"errorMessage":"This operation requires active subscription","messagePattern":"This operation requires active subscription","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/UserResource.java","lineNumber":433,"sourceCode":"\t\t\tuser.setNotifyOwnEvents(data.isNotifyOwnEvents());\n\t\tif (data.isKeepEmailAddressesPrivate() != null)\n\t\t\tuser.setKeepEmailAddressesPrivate(data.isKeepEmailAddressesPrivate());\n\t\tuserService.update(user, oldName);\n\n\t\tif (!getAuthUser().equals(user)) {\n\t\t\tvar newAuditContent = VersionedXmlDoc.fromBean(data).toXML();\n\t\t\tauditService.audit(null, \"changed account \\\"\" + user.getName() + \"\\\" via RESTful API\", oldAuditContent, newAuditContent);\n\t\t}\n\t\t\n\t\treturn Response.ok().build();\n    }\n\n\t@Api(order=1960, description=\"Disable user\")\n\t@Path(\"/{userId}/disable\")\n    @POST\n    public Response disableUser(@PathParam(\"userId\") Long userId) {\n\t\tif (!subscriptionService.isSubscriptionActive())\n\t\t\tthrow new NotAcceptableException(\"This operation requires active subscription\");\n\t\tif (!SecurityUtils.isAdministrator()) \n\t\t\tthrow new UnauthorizedException();\n\t\t\n\t\tif (userId <= User.ROOT_ID)\t\t\n\t\t\tthrow new BadRequestException(\"Should only disable normal users\");\n\t\tvar user = userService.load(userId);\n\t\tuserService.disable(user);\n\n\t\tauditService.audit(null, \"disabled account \\\"\" + user.getName() + \"\\\" via RESTful API\", null, null);\n\n\t\treturn Response.ok().build();\n    }\n\n\t@Api(order=1970, description=\"Enable user\")\n\t@Path(\"/{userId}/enable\")\n    @POST\n    public Response enableUser(@PathParam(\"userId\") Long userId) {\n\t\tif (!subscriptionService.isSubscriptionActive())","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/UserResource.java#L415-L451","documentation":"Thrown by UserResource.disableUser because disabling users via the REST API is an enterprise feature gated on an active OneDev subscription. The subscription check runs before the admin check, so even admins get this 406 when no subscription is active.","triggerScenarios":"POST /rest/users/{userId}/disable while subscriptionService.isSubscriptionActive() returns false (no license/subscription, or expired/trial subscription).","commonSituations":"Running the free/community edition and calling a gated endpoint; expired subscription; license not yet uploaded after upgrade.","solutions":["Upload/renew the OneDev enterprise license so a subscription is active.","Renew the expired subscription.","Disable the user through the UI/DB alternative available in your edition, if any.","Guard the automation to skip user disable when subscription is inactive."],"exampleFix":"// before\ndisableUser(userId); // 406 without subscription\n// after\nif (server.hasActiveSubscription())\n    disableUser(userId);\nelse\n    log.info(\"Subscription inactive; skipping disable for \" + userId);","handlingStrategy":"validation","validationCode":"if (!client.hasActiveSubscription())\n    throw new SkipException(\"User disable requires an active OneDev subscription\");","typeGuard":null,"tryCatchPattern":"try { client.disableUser(userId); }\ncatch (NotAcceptableException e) {\n    if (e.getMessage().contains(\"subscription\")) log.warn(\"Subscription inactive; cannot disable user via API\");\n    else throw e;\n}","preventionTips":["Verify the enterprise license is uploaded and current before running gated automation.","Gate disable/enable workflows behind a subscription capability check.","Monitor subscription expiry in ops dashboards."],"tags":["rest","subscription","licensing","user-disable"],"backgroundTag":"feature-not-enabled","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}