{"record":{"id":"585e6fccae5a65d0","repo":"apache/hadoop","slug":"unrecognized-unit-for-flush-interval-flushunit","errorCode":null,"errorMessage":"Unrecognized unit for flush interval: ${flushUnit}. Must be one of: minute, hour, day","messagePattern":"Unrecognized unit for flush interval: (.+?)\\. Must be one of: minute, hour, day","errorType":"exception","errorClass":"MetricsException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSink.java","lineNumber":383,"sourceCode":"        case \"m\":\n        case \"min\":\n        case \"minute\":\n        case \"minutes\":\n          millis = TimeUnit.MINUTES.toMillis(rollIntervalInt);\n          break;\n        case \"h\":\n        case \"hr\":\n        case \"hour\":\n        case \"hours\":\n          millis = TimeUnit.HOURS.toMillis(rollIntervalInt);\n          break;\n        case \"d\":\n        case \"day\":\n        case \"days\":\n          millis = TimeUnit.DAYS.toMillis(rollIntervalInt);\n          break;\n        default:\n          throw new MetricsException(\"Unrecognized unit for flush interval: \"\n              + flushUnit + \". Must be one of: minute, hour, day\");\n        }\n      }\n    } else {\n      throw new MetricsException(\"Unrecognized flush interval: \"\n          + rollInterval + \". Must be a number followed by an optional unit.\"\n          + \" The unit must be one of: minute, hour, day\");\n    }\n\n    if (millis < 60000) {\n      throw new MetricsException(\"The flush interval property must be \"\n          + \"at least 1 minute. Value was \" + rollInterval);\n    }\n\n    return millis;\n  }\n\n  /**","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSink.java#L365-L401","documentation":"The optional unit suffix of roll-interval must be one of the recognized minute/hour/day spellings, case-insensitive with abbreviations and plurals: m/min/minute/minutes, h/hr/hour/hours, d/day/days. Any other alphabetic suffix reaches the switch default and throws MetricsException(\"Unrecognized unit for flush interval: <unit>\"). Notably there is deliberately NO second unit — the smallest legal interval is one minute.","triggerScenarios":"roll-interval=30s, 45sec, 1week, 1w, 2fortnights — any suffix letters outside the m/h/d families, including valid units from other systems.","commonSituations":"Translating durations from Log4j/Logback rolling policies (which accept week) or Prometheus-style '30s'; assuming seconds are supported; trailing stray letters from a paste.","solutions":["Express the interval using an allowed unit: 30minutes, 2hours, 1day (or abbreviations 30min, 2h, 1d)","Sub-minute intervals are impossible — the sink enforces a 1-minute minimum by design","Check for accidental characters after the unit (e.g. '1hour,')"],"exampleFix":"# before\n*.sink.rolling.roll-interval=90seconds  # 'seconds' is not a recognized unit\n\n# after\n*.sink.rolling.roll-interval=2minutes","handlingStrategy":"validation","validationCode":"private static final Set<String> UNITS = Set.of(\"m\", \"min\", \"minute\", \"minutes\",\n    \"h\", \"hr\", \"hour\", \"hours\", \"d\", \"day\", \"days\");\nMatcher m = Pattern.compile(\"^\\\\s*(\\\\d+)\\\\s*([A-Za-z]*)\\\\s*$\").matcher(rollInterval);\nif (m.matches() && !m.group(2).isEmpty() && !UNITS.contains(m.group(2).toLowerCase())) {\n  throw new IllegalArgumentException(\"Unsupported roll-interval unit: \" + m.group(2));\n}","typeGuard":null,"tryCatchPattern":"try {\n  sink.init(subsetConf);\n} catch (MetricsException e) {\n  // 'Unrecognized unit for flush interval: <unit>' — only minute/hour/day (any case/abbrev/plural) allowed\n  LOG.error(\"Fix roll-interval unit '{}' — allowed: m/min/minute, h/hr/hour, d/day (plural ok)\",\n      badUnit, e);\n}","preventionTips":["Use canonical units (minutes/hours/days) in shared config templates","Remember seconds and weeks are not supported and sub-minute intervals are rejected downstream","Double-check values translated from other tools' rolling policies — their unit vocabularies differ"],"tags":["metrics2","rolling-file-sink","configuration","time-unit"],"backgroundTag":"invalid-time-unit","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}