{"record":{"id":"ff3b96696904d8a6","repo":"theonedev/onedev","slug":"invalid-working-period-value","errorCode":null,"errorMessage":"Invalid working period: ${value}","messagePattern":"Invalid working period: (.+?)","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"warning","filePath":"server-core/src/main/java/io/onedev/server/util/QueryUtils.java","lineNumber":76,"sourceCode":"\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid decimal: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static LabelSpec getLabelSpec(String labelName) {\n\t\tvar labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);\n\t\tif (labelSpec != null) \n\t\t\treturn labelSpec;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Undefined label: \" + labelName);\n\t}\n\t\n\tpublic static int getWorkingPeriodValue(String value) {\n\t\ttry {\n\t\t\tvar timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();\n\t\t\treturn timeTrackingSetting.parseWorkingPeriod(value);\n\t\t} catch (ValidationException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid working period: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static long getLongValue(String value) {\n\t\ttry {\n\t\t\treturn Long.parseLong(value);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid number: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static User getUser(String loginName) {\n\t\tUser user = OneDev.getInstance(UserService.class).findByName(loginName);\n\t\tif (user == null)\n\t\t\tthrow new NotFoundException(\"Unable to find user with login: \" + loginName);\n\t\treturn user;\n\t}\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/QueryUtils.java#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Match the format configured in Administration > Issue Settings > Time Tracking (e.g. '1d 4h')","Check the current working-period format and update saved queries after setting changes","Use only the units the setting accepts (e.g. w/d/h as configured)"],"exampleFix":"// before\nQueryUtils.getWorkingPeriodValue(\"2w 3days\"); // throws\n// after\nQueryUtils.getWorkingPeriodValue(\"2w 3d\"); // assuming w/d units configured","handlingStrategy":"validation","validationCode":"// regex must mirror the configured working-period format, e.g. w/d/h\nboolean valid = value.matches(\"\\\\d+w( \\\\d+d( \\\\d+h)?)?\");","typeGuard":null,"tryCatchPattern":"try {\n    int seconds = QueryUtils.getWorkingPeriodValue(raw);\n} catch (NotAcceptableException e) {\n    // re-prompt with the expected format from time tracking settings\n}","preventionTips":["Reuse the same parser/UI widget the time tracking setting provides","Announce and migrate saved queries when changing the working-period format","Document accepted units (w/d/h) for API consumers"],"tags":["query","time-tracking","duration-format","onedev"],"backgroundTag":"invalid-duration-format","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}