{"record":{"id":"c34241ea9ea6b1c4","repo":"theonedev/onedev","slug":"time-tracking-needs-to-be-enabled-for-the-project-c34241","errorCode":null,"errorMessage":"Time tracking needs to be enabled for the project","messagePattern":"Time tracking needs to be enabled for the project","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/IssueResource.java","lineNumber":324,"sourceCode":"\n\t@Api(order=1000)\n    @POST\n    public Long createIssue(@NotNull @Valid IssueOpenData data) {\n\t\tvar subject = SecurityUtils.getSubject();\n    \tvar user = SecurityUtils.getUser(subject);\n    \t\n    \tProject project = projectService.load(data.getProjectId());\n    \tif (!SecurityUtils.canAccessProject(project))\n\t\t\tthrow new UnauthorizedException();\n\n\t\tif (data.getIterationIds() != null && !data.getIterationIds().isEmpty() && !SecurityUtils.canScheduleIssues(project))\n\t\t\tthrow new UnauthorizedException(\"No permission to schedule issue. Remove iterationIds if you want to create issue without scheduling it.\");\n\n\t\tif (data.getOwnEstimatedTime() != null) {\n \t\t\tif (!subscriptionService.isSubscriptionActive())\t\t\t\n\t\t\t\tthrow new NotAcceptableException(\"An active subscription is required for this feature\");\n\t\t\tif (!project.isTimeTracking())\n\t\t\t\tthrow new NotAcceptableException(\"Time tracking needs to be enabled for the project\");\n\t\t\tif (!SecurityUtils.canScheduleIssues(project))\n\t\t\t\tthrow new UnauthorizedException(\"Issue schedule permission required to set own estimated time. Remove ownEstimatedTime if you want to create issue without setting own estimated time.\");\n\t\t}\n\n\t\tvar issueSetting = settingService.getIssueSetting();\n\t\t\n\t\tIssue issue = new Issue();\n\t\tissue.setTitle(data.getTitle());\n\t\tissue.setDescription(data.getDescription());\n\t\tissue.setConfidential(data.isConfidential());\n\t\tissue.setProject(project);\n\t\tissue.setSubmitDate(new Date());\n\t\tissue.setSubmitter(user);\n\t\tissue.setState(issueSetting.getInitialStateSpec().getName());\n\t\tif (data.getOwnEstimatedTime() != null)\n\t\t\tissue.setOwnEstimatedTime(data.getOwnEstimatedTime());\n\n\t\tif (data.getIterationIds() != null) {","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/IssueResource.java#L306-L342","documentation":"OneDev's REST API rejects setting a non-null ownEstimatedTime on issue creation when the target project does not have time tracking enabled. Time tracking is a project setting; the API enforces it as a precondition (NotAcceptableException, HTTP 406). The feature also requires an active subscription, which is checked first.","triggerScenarios":"POST to /api/issues (createIssue) with a body where ownEstimatedTime is set, while the resolved project (from projectPath/number scope) has project.isTimeTracking() == false.","commonSituations":"Automation scripts that create issues with time estimates against a project where the 'Time tracking' setting was never enabled or was later disabled; reusing issue-creation payloads across projects.","solutions":["Enable time tracking in the project: Project -> Settings (Time tracking) toggle, or via ProjectConfig in UI.","Remove ownEstimatedTime from the request body if estimates are not needed.","Create the issue in a different project that has time tracking enabled."],"exampleFix":"// before\ncurl -X POST .../api/issues -d '{\"title\":\"t\",\"ownEstimatedTime\":120,...}'\n// after\ncurl -X POST .../api/issues -d '{\"title\":\"t\"}'  # or enable time tracking on the project first","handlingStrategy":"validation","validationCode":"const project = await getProject(projectPath);\nif (body.ownEstimatedTime != null && !project.timeTracking)\n  throw new Error(`Time tracking is disabled for project ${projectPath}; omit ownEstimatedTime or enable it`);","typeGuard":"function canSetEstimate(project, body) {\n  return body.ownEstimatedTime == null || project.timeTracking === true;\n}","tryCatchPattern":null,"preventionTips":["Check project settings before posting issues with estimates.","Keep issue-creation payloads per-project instead of shared templates.","Document that estimates require the time-tracking toggle."],"tags":["rest-api","time-tracking","project-config","validation"],"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"}