theonedev/onedev · warning · NotAcceptableException

Invalid working period: ${value}

Error message

Invalid working period: ${value}

What it means

QueryUtils.getWorkingPeriodValue delegates parsing to the time tracking setting's parseWorkingPeriod, which understands configured working-period formats (e.g. '3d 2h'). A ValidationException from that parser is rethrown as NotAcceptableException("Invalid working period: ...") so bad duration operands in queries fail as validation errors.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:76

		} catch (NumberFormatException e) {
			throw new NotAcceptableException("Invalid decimal: " + value);
		}
	}
	
	public static LabelSpec getLabelSpec(String labelName) {
		var labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);
		if (labelSpec != null) 
			return labelSpec;
		else
			throw new NotFoundException("Undefined label: " + labelName);
	}
	
	public static int getWorkingPeriodValue(String value) {
		try {
			var timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();
			return timeTrackingSetting.parseWorkingPeriod(value);
		} catch (ValidationException e) {
			throw new NotAcceptableException("Invalid working period: " + value);
		}
	}
	
	public static long getLongValue(String value) {
		try {
			return Long.parseLong(value);
		} catch (NumberFormatException e) {
			throw new NotAcceptableException("Invalid number: " + value);
		}
	}
	
	public static User getUser(String loginName) {
		User user = OneDev.getInstance(UserService.class).findByName(loginName);
		if (user == null)
			throw new NotFoundException("Unable to find user with login: " + loginName);
		return user;
	}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Match the format configured in Administration > Issue Settings > Time Tracking (e.g. '1d 4h')
  2. Check the current working-period format and update saved queries after setting changes
  3. Use only the units the setting accepts (e.g. w/d/h as configured)

Example fix

// before
QueryUtils.getWorkingPeriodValue("2w 3days"); // throws
// after
QueryUtils.getWorkingPeriodValue("2w 3d"); // assuming w/d units configured
Defensive patterns

Strategy: validation

Validate before calling

// regex must mirror the configured working-period format, e.g. w/d/h
boolean valid = value.matches("\\d+w( \\d+d( \\d+h)?)?");

Try / catch

try {
    int seconds = QueryUtils.getWorkingPeriodValue(raw);
} catch (NotAcceptableException e) {
    // re-prompt with the expected format from time tracking settings
}

Prevention

When it happens

Trigger: Using a duration operand that does not match the configured working-period format (e.g. '2 weeks' when only d/h units are configured, or a bare number where unit is required) in time-tracking-related issue query criteria.

Common situations: Admins changing the time tracking format after users saved queries using the old format; typos like '3d2h' without space when the format requires separators; locale-mismatched unit abbreviations.

Understand the failure class

Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.

Related errors


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