{"record":{"id":"94651cf28b186f62","repo":"apache/flink","slug":"time-interval-unit-label-unitlabel-does-not-m","errorCode":null,"errorMessage":"Time interval unit label '${unitLabel}' does not match any of the recognized units: ${units}","messagePattern":"Time interval unit label '(.+?)' does not match any of the recognized units: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/TimeUtils.java","lineNumber":112,"sourceCode":"            }\n        }\n\n        final BigInteger value;\n        try {\n            value = new BigInteger(number); // this throws a NumberFormatException\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\n                    \"The value '\" + number + \"' cannot be represented as an integer number.\", e);\n        }\n\n        final ChronoUnit unit;\n        if (unitLabel.isEmpty()) {\n            unit = ChronoUnit.MILLIS;\n        } else {\n            unit = LABEL_TO_UNIT_MAP.get(unitLabel);\n        }\n        if (unit == null) {\n            throw new IllegalArgumentException(\n                    \"Time interval unit label '\"\n                            + unitLabel\n                            + \"' does not match any of the recognized units: \"\n                            + TimeUnit.getAllUnits());\n        }\n\n        try {\n            return convertBigIntToDuration(value, unit);\n        } catch (ArithmeticException e) {\n            throw new IllegalArgumentException(\n                    \"The value '\"\n                            + number\n                            + \"' cannot be represented as Duration (numeric overflow).\",\n                    e);\n        }\n    }\n\n    private static Duration convertBigIntToDuration(BigInteger value, ChronoUnit unit) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/TimeUtils.java#L94-L130","documentation":"parseDuration splits the trailing text after the number as a unit label and looks it up in LABEL_TO_UNIT_MAP (ns/us/ms/s/m/min/h/d and synonyms, case-insensitive). An unrecognized label produces this IllegalArgumentException enumerating all accepted units via TimeUnit.getAllUnits().","triggerScenarios":"Calling TimeUtils.parseDuration(\"10 sec\"), \"5 hours\", \"1000ms \" with a typo, or a unit from another system (\"10m\" is fine as minutes; \"10w\" for weeks is not).","commonSituations":"Using units not supported by Flink's config format (weeks, 'sec' instead of 's', 'H' is fine but 'hr' is not), copy-paste from Java Duration.toString output (e.g. \"PT10S\" works but mangled variants do not), localized unit abbreviations.","solutions":["Check the accepted units listed in the error message and use one of them (e.g. \"10 s\" not \"10 sec\").","Prefer the canonical short forms: ns, us, ms, s, m/min, h, d.","For exotic units, convert yourself: 2 weeks -> \"14 d\"."],"exampleFix":"# before\nstate.backend.retry.delay=10 sec\n\n# after\nstate.backend.retry.delay=10 s","handlingStrategy":"validation","validationCode":"private static final Set<String> OK = Set.of(\"ns\",\"us\",\"ms\",\"s\",\"m\",\"min\",\"h\",\"d\");\nString t = text.trim().toLowerCase(Locale.ROOT);\nString unit = t.replaceFirst(\"^\\\\d+\\\\s*\", \"\");\nif (!unit.isEmpty() && !OK.contains(unit)) throw new IllegalArgumentException(\"Unknown unit: \" + unit);\nTimeUtils.parseDuration(text);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stick to canonical short units: ns, us, ms, s, m/min, h, d.","The error message itself lists valid units — read it before guessing.","Convert unsupported units (weeks) yourself before config."],"tags":["configuration","duration","units","parsing"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}