theonedev/onedev · error · ExplicitException

Time tracking needs to be enabled for the project

Error message

Time tracking needs to be enabled for the project

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/IssueHelper.java:289

        Issue issue = new Issue();
        var title = (String) data.remove("title");
        if (title == null)
            throw new ExplicitException("Title is required");
        issue.setTitle(title);
        var description = (String) data.remove("description");
        issue.setDescription(description);
        var confidential = (Boolean) data.remove("confidential");
        if (confidential != null)
            issue.setConfidential(confidential);

        Integer ownEstimatedTime = (Integer) data.remove("ownEstimatedTime");
        if (ownEstimatedTime != null) {
            var subscriptionService = OneDev.getInstance(SubscriptionService.class);
            if (!subscriptionService.isSubscriptionActive())
                throw new ExplicitException("An active subscription is required for this feature");
            if (!project.isTimeTracking())
                throw new ExplicitException("Time tracking needs to be enabled for the project");
            if (!SecurityUtils.canScheduleIssues(subject, project))
                throw new UnauthorizedException("Issue schedule permission required to set own estimated time");
            issue.setOwnEstimatedTime(ownEstimatedTime * 60);
        }

        List<String> iterationNames = (List<String>) data.remove("iterations");
        if (iterationNames != null) {
            if (!SecurityUtils.canScheduleIssues(subject, project))
                throw new UnauthorizedException("Issue schedule permission required to set iterations");
            var iterationService = OneDev.getInstance(IterationService.class);
            for (var iterationName : iterationNames) {
                var iteration = iterationService.findInHierarchy(project, iterationName);
                if (iteration == null)
                    throw new ExplicitException("Iteration '" + iterationName + "' not found");
                IssueSchedule schedule = new IssueSchedule();
                schedule.setIssue(issue);
                schedule.setIteration(iteration);
                issue.getSchedules().add(schedule);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Enable time tracking on the project (Project > Preferences/Issues > enable time tracking) before creating issues with estimated time
  2. Remove "ownEstimatedTime" from the data map for projects without time tracking
  3. Enable time tracking in the issue setting defaults applied to new projects

Example fix

// before
data.put("ownEstimatedTime", 4);
// after: enable first, or omit
if (project.isTimeTracking()) data.put("ownEstimatedTime", 4);
Defensive patterns

Strategy: validation

Validate before calling

if (data.containsKey("ownEstimatedTime") && !project.isTimeTracking())
    data.remove("ownEstimatedTime"); // or enable time tracking first

Try / catch

try {
    issueHelper.createIssue(project, subject, data);
} catch (ExplicitException e) {
    if ("Time tracking needs to be enabled for the project".equals(e.getMessage())) {
        // enable project time tracking or retry without ownEstimatedTime
    }
}

Prevention

When it happens

Trigger: Data map contains "ownEstimatedTime" while the target project's time tracking setting is disabled.

Common situations: Fresh projects created without enabling time tracking; scripts/AI tools assuming project defaults; project imported without its time-tracking setting.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/fee20e2a38671f02. Report an issue: GitHub.