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

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/IssueResource.java:324

	@Api(order=1000)
    @POST
    public Long createIssue(@NotNull @Valid IssueOpenData data) {
		var subject = SecurityUtils.getSubject();
    	var user = SecurityUtils.getUser(subject);
    	
    	Project project = projectService.load(data.getProjectId());
    	if (!SecurityUtils.canAccessProject(project))
			throw new UnauthorizedException();

		if (data.getIterationIds() != null && !data.getIterationIds().isEmpty() && !SecurityUtils.canScheduleIssues(project))
			throw new UnauthorizedException("No permission to schedule issue. Remove iterationIds if you want to create issue without scheduling it.");

		if (data.getOwnEstimatedTime() != null) {
 			if (!subscriptionService.isSubscriptionActive())			
				throw new NotAcceptableException("An active subscription is required for this feature");
			if (!project.isTimeTracking())
				throw new NotAcceptableException("Time tracking needs to be enabled for the project");
			if (!SecurityUtils.canScheduleIssues(project))
				throw new UnauthorizedException("Issue schedule permission required to set own estimated time. Remove ownEstimatedTime if you want to create issue without setting own estimated time.");
		}

		var issueSetting = settingService.getIssueSetting();
		
		Issue issue = new Issue();
		issue.setTitle(data.getTitle());
		issue.setDescription(data.getDescription());
		issue.setConfidential(data.isConfidential());
		issue.setProject(project);
		issue.setSubmitDate(new Date());
		issue.setSubmitter(user);
		issue.setState(issueSetting.getInitialStateSpec().getName());
		if (data.getOwnEstimatedTime() != null)
			issue.setOwnEstimatedTime(data.getOwnEstimatedTime());

		if (data.getIterationIds() != null) {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Enable time tracking in the project: Project -> Settings (Time tracking) toggle, or via ProjectConfig in UI.
  2. Remove ownEstimatedTime from the request body if estimates are not needed.
  3. Create the issue in a different project that has time tracking enabled.

Example fix

// before
curl -X POST .../api/issues -d '{"title":"t","ownEstimatedTime":120,...}'
// after
curl -X POST .../api/issues -d '{"title":"t"}'  # or enable time tracking on the project first
Defensive patterns

Strategy: validation

Validate before calling

const project = await getProject(projectPath);
if (body.ownEstimatedTime != null && !project.timeTracking)
  throw new Error(`Time tracking is disabled for project ${projectPath}; omit ownEstimatedTime or enable it`);

Type guard

function canSetEstimate(project, body) {
  return body.ownEstimatedTime == null || project.timeTracking === true;
}

Prevention

When it happens

Trigger: POST to /api/issues (createIssue) with a body where ownEstimatedTime is set, while the resolved project (from projectPath/number scope) has project.isTimeTracking() == false.

Common situations: 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.

Related errors


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