theonedev/onedev · error · NotAcceptableException

Time tracking needs to be enabled for the project

Error message

Time tracking needs to be enabled for the project

What it means

Even with an active subscription, setting "ownEstimatedTime" fails with NotAcceptableException("Time tracking needs to be enabled for the project") when issue.getProject().isTimeTracking() is false. Each project must opt in to time tracking before estimated-time values can be changed.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:626

        if (data.containsKey("description")) {
            if (!SecurityUtils.canModifyIssue(subject, issue))
                throw new UnauthorizedException("No permission to update issue description");
            issueChangeService.changeDescription(user, issue, (String) data.remove("description"));
        }

        var confidential = (Boolean) data.remove("confidential");
        if (confidential != null) {
            if (!SecurityUtils.canModifyIssue(subject, issue))
                throw new UnauthorizedException("No permission to update issue confidential");
            issueChangeService.changeConfidential(user, issue, confidential);
        }

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

        @SuppressWarnings("unchecked")
        List<String> iterationNames = (List<String>) data.remove("iterations");
        if (iterationNames != null) {
            if (!SecurityUtils.canScheduleIssues(subject, issue.getProject()))
                throw new UnauthorizedException("Issue schedule permission required to set iterations");
            var iterations = new ArrayList<Iteration>();
            for (var iterationName : iterationNames) {
                var iteration = iterationService.findInHierarchy(issue.getProject(), iterationName);
                if (iteration == null)
                    throw new NotFoundException("Iteration '" + iterationName + "' not found");
                iterations.add(iteration);
            }
            issueChangeService.changeIterations(user, issue, iterations);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Enable Time Tracking for the project: Project > Preferences/Settings > enable time tracking.
  2. Remove "ownEstimatedTime" from the payload for projects where tracking is intentionally off.
  3. Batch-enable time tracking across projects if tooling targets many projects.
  4. Check the error ordering: fix this before asserting schedule permissions, as the subscription check precedes it.

Example fix

// before
// project "proj" has time tracking disabled
editIssue("proj", ref, {ownEstimatedTime: 4}) // 406
// after
// Project Settings -> enable Time Tracking, then:
editIssue("proj", ref, {ownEstimatedTime: 4})
Defensive patterns

Strategy: validation

Validate before calling

// ensure the target project has time tracking enabled
const project = await getProject(projectPath);
if ('ownEstimatedTime' in payload && !project.timeTracking) {
  delete payload.ownEstimatedTime;
  throw new Error(`Enable Time Tracking on project '${projectPath}' first`);
}

Try / catch

try { await editIssue(projectPath, ref, {ownEstimatedTime}); } catch (e) { if (e.status === 406 && /time tracking/i.test(e.message)) { await enableProjectTimeTracking(projectPath); return retry(); } throw e; }

Prevention

When it happens

Trigger: POST /edit-issue with "ownEstimatedTime" on a project whose Time Tracking setting is disabled, while the server subscription is active.

Common situations: New projects created without enabling time tracking; AI agents configured globally but used against projects with default settings; migrated projects missing the setting.

Related errors


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