theonedev/onedev · error · NotAcceptableException

Time tracking not enabled for project

Error message

Time tracking not enabled for project

What it means

IssueWorkResource.createWork throws this ValidationException/NotAcceptable when the issue's project has time tracking disabled (Project.isTimeTracking() == false). OneDev requires the per-project 'Time Tracking' setting to be enabled before work can be logged, and the REST API enforces it server-side.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/IssueWorkResource.java:61

	@Api(order=100)
	@Path("/{workId}")
	@GET
	public IssueWork getWork(@PathParam("workId") Long workId) {
		if (!subscriptionService.isSubscriptionActive())
			throw new UnsupportedOperationException("This feature requires an active subscription");
		IssueWork work = workService.load(workId);
    	if (!SecurityUtils.canAccessIssue(work.getIssue()))  
			throw new UnauthorizedException();
    	return work;
	}
	
	@Api(order=200, description="Log new issue work")
	@POST
	public Long createWork(@NotNull IssueWork work) {
		if (!subscriptionService.isSubscriptionActive()) 
			throw new NotAcceptableException("This feature requires an active subscription");
		if (!work.getIssue().getProject().isTimeTracking())
			throw new NotAcceptableException("Time tracking not enabled for project");
		
    	if (!SecurityUtils.canAccessIssue(work.getIssue()) 
				|| !SecurityUtils.isAdministrator() && !work.getUser().equals(SecurityUtils.getAuthUser())) {
			throw new UnauthorizedException();
		}
		workService.createOrUpdate(work);
		
		return work.getId();
	}

	@Api(order=250, description="Update issue work of specified id")
	@Path("/{workId}")
	@POST
	public Response updateWork(@PathParam("workId") Long workId, @NotNull IssueWork work) {
		if (!canModifyOrDelete(work)) 
			throw new UnauthorizedException();
		
		workService.createOrUpdate(work);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Enable Time Tracking in the project's settings (Project > Settings > General/Time Tracking)
  2. Confirm the issue belongs to the project you think it does; move the work log to a project with tracking enabled
  3. Update automation scripts to check project time-tracking state before posting work

Example fix

// before
// project 'myproj' has timeTracking=false
POST /~api/issue-works -> 406 Time tracking not enabled for project
// after
// in project settings: enable Time Tracking, then retry the same request
Defensive patterns

Strategy: validation

Validate before calling

var project = issue.getProject();
if (!project.isTimeTracking()) throw new IllegalStateException("Enable Time Tracking for project " + project.getPath());

Try / catch

try { createIssueWork(work); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 406) enableTimeTrackingThenRetry(); else throw e; }

Prevention

When it happens

Trigger: POSTing an IssueWork via the REST API to an issue whose project has the Time Tracking setting turned off.

Common situations: Newly created project where time tracking was never enabled; project settings changed after integrations were built; CI scripts logging work against a different project than intended.

Related errors


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