{"record":{"id":"4513372a3aca5db3","repo":"theonedev/onedev","slug":"time-tracking-not-enabled-for-project","errorCode":null,"errorMessage":"Time tracking not enabled for project","messagePattern":"Time tracking not enabled for project","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/IssueWorkResource.java","lineNumber":61,"sourceCode":"\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}\n\t\tworkService.createOrUpdate(work);\n\t\t\n\t\treturn work.getId();\n\t}\n\n\t@Api(order=250, description=\"Update issue work of specified id\")\n\t@Path(\"/{workId}\")\n\t@POST\n\tpublic Response updateWork(@PathParam(\"workId\") Long workId, @NotNull IssueWork work) {\n\t\tif (!canModifyOrDelete(work)) \n\t\t\tthrow new UnauthorizedException();\n\t\t\n\t\tworkService.createOrUpdate(work);","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/IssueWorkResource.java#L43-L79","documentation":"IssueWorkResource.createWork throws this ValidationException/NotAcceptable when the issue's project has time tracking disabled (Project.isTimeTracking() == false). OneDev requires the per-project 'Time Tracking' setting to be enabled before work can be logged, and the REST API enforces it server-side.","triggerScenarios":"POSTing an IssueWork via the REST API to an issue whose project has the Time Tracking setting turned off.","commonSituations":"Newly created project where time tracking was never enabled; project settings changed after integrations were built; CI scripts logging work against a different project than intended.","solutions":["Enable Time Tracking in the project's settings (Project > Settings > General/Time Tracking)","Confirm the issue belongs to the project you think it does; move the work log to a project with tracking enabled","Update automation scripts to check project time-tracking state before posting work"],"exampleFix":"// before\n// project 'myproj' has timeTracking=false\nPOST /~api/issue-works -> 406 Time tracking not enabled for project\n// after\n// in project settings: enable Time Tracking, then retry the same request","handlingStrategy":"validation","validationCode":"var project = issue.getProject();\nif (!project.isTimeTracking()) throw new IllegalStateException(\"Enable Time Tracking for project \" + project.getPath());","typeGuard":null,"tryCatchPattern":"try { createIssueWork(work); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 406) enableTimeTrackingThenRetry(); else throw e; }","preventionTips":["Enable Time Tracking in project settings before building integrations","Verify target project path in automation configs","Add a preflight settings check in scripts"],"tags":["rest","timetracking","project-settings"],"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"}