{"record":{"id":"fee20e2a38671f02","repo":"theonedev/onedev","slug":"time-tracking-needs-to-be-enabled-for-the-project","errorCode":null,"errorMessage":"Time tracking needs to be enabled for the project","messagePattern":"Time tracking needs to be enabled for the project","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/IssueHelper.java","lineNumber":289,"sourceCode":"\n        Issue issue = new Issue();\n        var title = (String) data.remove(\"title\");\n        if (title == null)\n            throw new ExplicitException(\"Title is required\");\n        issue.setTitle(title);\n        var description = (String) data.remove(\"description\");\n        issue.setDescription(description);\n        var confidential = (Boolean) data.remove(\"confidential\");\n        if (confidential != null)\n            issue.setConfidential(confidential);\n\n        Integer ownEstimatedTime = (Integer) data.remove(\"ownEstimatedTime\");\n        if (ownEstimatedTime != null) {\n            var subscriptionService = OneDev.getInstance(SubscriptionService.class);\n            if (!subscriptionService.isSubscriptionActive())\n                throw new ExplicitException(\"An active subscription is required for this feature\");\n            if (!project.isTimeTracking())\n                throw new ExplicitException(\"Time tracking needs to be enabled for the project\");\n            if (!SecurityUtils.canScheduleIssues(subject, project))\n                throw new UnauthorizedException(\"Issue schedule permission required to set own estimated time\");\n            issue.setOwnEstimatedTime(ownEstimatedTime * 60);\n        }\n\n        List<String> iterationNames = (List<String>) data.remove(\"iterations\");\n        if (iterationNames != null) {\n            if (!SecurityUtils.canScheduleIssues(subject, project))\n                throw new UnauthorizedException(\"Issue schedule permission required to set iterations\");\n            var iterationService = OneDev.getInstance(IterationService.class);\n            for (var iterationName : iterationNames) {\n                var iteration = iterationService.findInHierarchy(project, iterationName);\n                if (iteration == null)\n                    throw new ExplicitException(\"Iteration '\" + iterationName + \"' not found\");\n                IssueSchedule schedule = new IssueSchedule();\n                schedule.setIssue(issue);\n                schedule.setIteration(iteration);\n                issue.getSchedules().add(schedule);","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/IssueHelper.java#L271-L307","documentation":"Thrown by createIssue when the AI-driven issue creation payload includes time-tracking fields (e.g. ownEstimatedTime) but the target project has time tracking disabled in its issue settings. It is a guard telling the caller to enable time tracking before submitting estimated/spent time values.","triggerScenarios":"Data map contains \"ownEstimatedTime\" while the target project's time tracking setting is disabled.","commonSituations":"Fresh projects created without enabling time tracking; scripts/AI tools assuming project defaults; project imported without its time-tracking setting.","solutions":["Enable time tracking on the project (Project > Preferences/Issues > enable time tracking) before creating issues with estimated time","Remove \"ownEstimatedTime\" from the data map for projects without time tracking","Enable time tracking in the issue setting defaults applied to new projects"],"exampleFix":"// before\ndata.put(\"ownEstimatedTime\", 4);\n// after: enable first, or omit\nif (project.isTimeTracking()) data.put(\"ownEstimatedTime\", 4);","handlingStrategy":"validation","validationCode":"if (data.containsKey(\"ownEstimatedTime\") && !project.isTimeTracking())\n    data.remove(\"ownEstimatedTime\"); // or enable time tracking first","typeGuard":null,"tryCatchPattern":"try {\n    issueHelper.createIssue(project, subject, data);\n} catch (ExplicitException e) {\n    if (\"Time tracking needs to be enabled for the project\".equals(e.getMessage())) {\n        // enable project time tracking or retry without ownEstimatedTime\n    }\n}","preventionTips":["Enable time tracking on projects that use estimated-time automation","Check project.isTimeTracking() before sending estimated-time fields","Standardize project templates with time tracking enabled"],"tags":["project-config","time-tracking","issues"],"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"}