{"record":{"id":"4360bdea416c5f8b","repo":"theonedev/onedev","slug":"this-feature-requires-an-active-subscription","errorCode":null,"errorMessage":"This feature requires an active subscription","messagePattern":"This feature requires an active subscription","errorType":"http","errorClass":"UnsupportedOperationException","httpStatus":500,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/IssueWorkResource.java","lineNumber":48,"sourceCode":"@Singleton\npublic class IssueWorkResource {\n\n\tprivate final IssueWorkService workService;\n\t\n\tprivate final SubscriptionService subscriptionService;\n\t\n\t@Inject\n\tpublic IssueWorkResource(IssueWorkService workService, SubscriptionService subscriptionService) {\n\t\tthis.workService = workService;\n\t\tthis.subscriptionService = subscriptionService;\n\t}\n\n\t@Api(order=100)\n\t@Path(\"/{workId}\")\n\t@GET\n\tpublic IssueWork getWork(@PathParam(\"workId\") Long workId) {\n\t\tif (!subscriptionService.isSubscriptionActive())\n\t\t\tthrow new UnsupportedOperationException(\"This feature requires an active subscription\");\n\t\tIssueWork work = workService.load(workId);\n    \tif (!SecurityUtils.canAccessIssue(work.getIssue()))  \n\t\t\tthrow new UnauthorizedException();\n    \treturn work;\n\t}\n\t\n\t@Api(order=200, description=\"Log new issue work\")\n\t@POST\n\tpublic Long createWork(@NotNull IssueWork work) {\n\t\tif (!subscriptionService.isSubscriptionActive()) \n\t\t\tthrow new NotAcceptableException(\"This feature requires an active subscription\");\n\t\tif (!work.getIssue().getProject().isTimeTracking())\n\t\t\tthrow new NotAcceptableException(\"Time tracking not enabled for project\");\n\t\t\n    \tif (!SecurityUtils.canAccessIssue(work.getIssue()) \n\t\t\t\t|| !SecurityUtils.isAdministrator() && !work.getUser().equals(SecurityUtils.getAuthUser())) {\n\t\t\tthrow new UnauthorizedException();\n\t\t}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/IssueWorkResource.java#L30-L66","documentation":"Issue work logs (time tracking records) are a premium feature. The GET /api/issues/{issueId}/works/{workId} endpoint (getWork) throws UnsupportedOperationException when no active subscription exists, before even loading the work record.","triggerScenarios":"GET request to the issue work resource path ({issueId}/works/{workId}) on a OneDev instance without an active subscription.","commonSituations":"Scripting against a free/community installation; subscription lapsed; querying work logs for audit/reporting in an unlicensed environment.","solutions":["Activate or renew the subscription in server license settings.","Skip work-log endpoints when running unlicensed; read time data elsewhere.","Gate the integration on subscription state before calling the endpoint."],"exampleFix":"// before\nGET /api/issues/12/works/3  -> UnsupportedOperationException\n// after: activate subscription (Server Setting -> Subscription), then retry GET","handlingStrategy":"try-catch","validationCode":"const sub = await getSubscriptionStatus();\nif (!sub.active) throw new Error('Issue work endpoints require an active subscription');","typeGuard":"function subscriptionActive(serverInfo) {\n  return serverInfo?.subscriptionStatus === 'ACTIVE';\n}","tryCatchPattern":"try {\n  return await api.getIssueWork(issueId, workId);\n} catch (e) {\n  if (e instanceof UnsupportedOperationError || /requires an active subscription/.test(String(e.message)))\n    return null; // premium feature unavailable\n  throw e;\n}","preventionTips":["Feature-detect premium endpoints by checking subscription state at startup.","Treat UnsupportedOperationException from these endpoints as a licensing signal, not a bug.","Keep license renewal alerts ahead of expiry to avoid breaking integrations."],"tags":["rest-api","subscription","licensing","time-tracking"],"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"}