{"record":{"id":"f2be08ab122e1f20","repo":"apache/beam","slug":"f-invalid-windowing-name-value-suffix-if-not-value-else","errorCode":null,"errorMessage":"f\"Invalid windowing {name} value '{suffix if not value else value}'. Must provide numeric value.\"","messagePattern":"f\"Invalid windowing (.+?) value '(.+?)'\\. Must provide numeric value\\.\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_provider.py","lineNumber":1130,"sourceCode":"      windowing: the type and parameters of the windowing to perform\n    \"\"\"\n    def __init__(self, windowing):\n      self._window_transform = self._parse_window_spec(windowing)\n\n    def expand(self, pcoll):\n      return pcoll | self._window_transform\n\n    @staticmethod\n    def _parse_duration(value, name):\n      time_units = {\n          'ms': 0.001, 's': 1, 'm': 60, 'h': 60 * 60, 'd': 60 * 60 * 12\n      }\n      value, suffix = re.match(r'^(.*?)([^\\d]*)$', str(value)).groups()\n      # Default to seconds if time unit suffix is not defined\n      if not suffix:\n        suffix = 's'\n      if not value:\n        raise ValueError(\n            f\"Invalid windowing {name} value \"\n            f\"'{suffix if not value else value}'. \"\n            f\"Must provide numeric value.\")\n      if suffix not in time_units:\n        raise ValueError((\n            \"Invalid windowing {} time unit '{}'. \" +\n            \"Valid time units are {}.\").format(\n                name,\n                suffix,\n                ', '.join(\"'{}'\".format(k) for k in time_units.keys())))\n      return float(value) * time_units[suffix]\n\n    @staticmethod\n    def _parse_window_spec(spec):\n      spec = dict(spec)\n      window_type = spec.pop('type')\n      # TODO: These are in seconds, perhaps parse duration strings meaningfully?\n      if window_type == 'global':","sourceCodeStart":1112,"sourceCodeEnd":1148,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_provider.py#L1112-L1148","documentation":"Raised by YamlProviders.WindowInto._parse_duration in apache_beam yaml_provider.py when a windowing duration/offset parameter has no numeric part after stripping the optional time-unit suffix. The regex '^(.*?)([^\\d]*)$' splits the value into digits and a suffix; if the numeric part is empty, no usable duration was provided.","triggerScenarios":"Calling WindowInto (via YAML 'Assign windows to elements based on their timestamp' transform) with a duration, gap, or offset parameter whose value is a non-numeric string such as 'sec', 'minutes', '' (empty string), or a value whose digits were all consumed by the suffix regex.","commonSituations":"YAML pipeline authors write 'gap: minutes' instead of 'gap: 5m' or 'gap: 300s', omit the number entirely, or pass a config-substituted placeholder that resolves to a unit-only string.","solutions":["Provide a numeric value, optionally with a time-unit suffix, e.g. 'gap: 5m' or 'gap: 300s'.","If the value comes from a parameter/options substitution, verify it resolves to a numeric string before the pipeline runs.","Default the value in the YAML or calling code, e.g. use a coalesce/default so an empty value becomes '60s'."],"exampleFix":"# before\ngap: minutes\n# after\ngap: 10m","handlingStrategy":"validation","validationCode":"def validate_windowing_value(value):\n    m = re.match(r'^(.*?)([^\\d]*)$', str(value))\n    if not m or not m.group(1):\n        raise ValueError(f'Windowing value {value!r} must include a numeric value, e.g. \"5m\"')","typeGuard":"def is_valid_duration_str(v):\n    return bool(re.fullmatch(r'\\s*\\d+(\\.\\d+)?\\s*[smhd]?\\s*', str(v)))","tryCatchPattern":"try:\n    result = beam.WindowInto(window.Sessions(gap))\nexcept ValueError as e:\n    if 'Invalid windowing' in str(e):\n        logging.error('Bad windowing config: %s', e)\n        gap = '60s'  # fallback default\n    else:\n        raise","preventionTips":["Always include a number with the unit, e.g. '5m' not 'm'.","Use parameter validation before submitting YAML pipelines.","Prefer explicit seconds ('300s') when values come from substitutions.","Add schema validation of YAML pipeline options at CI time."],"tags":["python","apache-beam","yaml","windowing"],"backgroundTag":"invalid-duration-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}