{"record":{"id":"6bb56b0be2e685de","repo":"apache/beam","slug":"resource-hint-hint-has-invalid-value-value","errorCode":null,"errorMessage":"Resource hint {hint} has invalid value {value}.","messagePattern":"Resource hint (.+?) has invalid value (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/resources.py","lineNumber":225,"sourceCode":"# Alias for interoperability with SDKs preferring camelCase.\nResourceHint.register_resource_hint(\n    'MaxActiveBundlesPerWorker', MaxActiveBundlesPerWorkerHint)\n# Alias for common typo.\nResourceHint.register_resource_hint(\n    'max_active_bundle_per_worker', MaxActiveBundlesPerWorkerHint)\nResourceHint.register_resource_hint(\n    'MaxActiveBundlePerWorker', MaxActiveBundlesPerWorkerHint)\n\n\ndef parse_resource_hints(hints: dict[Any, Any]) -> dict[str, bytes]:\n  parsed_hints = {}\n  for hint, value in hints.items():\n    try:\n      hint_cls = ResourceHint.get_by_name(hint)\n      try:\n        parsed_hints.update(hint_cls.parse(value))\n      except ValueError:\n        raise ValueError(f\"Resource hint {hint} has invalid value {value}.\")\n    except KeyError:\n      raise ValueError(f\"Unknown resource hint: {hint}.\")\n\n  return parsed_hints\n\n\ndef resource_hints_from_options(\n    options: Optional[PipelineOptions]) -> dict[str, bytes]:\n  if options is None:\n    return {}\n  hints = {}\n  option_specified_hints = options.view_as(StandardOptions).resource_hints\n\n  if isinstance(option_specified_hints, dict):\n    return parse_resource_hints(option_specified_hints)\n\n  for hint in option_specified_hints:\n    if '=' in hint:","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/resources.py#L207-L243","documentation":"parse_resource_hints looks up a registered ResourceHint class by name and calls its parse() on the value. When the value is syntactically wrong for that hint type, parse() raises ValueError, which is re-raised with the hint name and value embedded. It indicates a well-known hint whose value failed hint-specific parsing.","triggerScenarios":"resource_hints_from_options collects hint key=value pairs from pipeline options; e.g. hint 'min_ram_mb' with value 'abc', or a parser-specific malformed value (like error 3830/3831) is wrapped and re-raised as this message.","commonSituations":"Typo'd or hand-edited values in pipeline option resource hints; platform-specific hint values (e.g. accelerator specs) whose expected format changed between Beam versions/runners.","solutions":["Correct the value to the format expected by the hint's parse() method (e.g. 'min_ram_mb=4096MB').","Inspect the inner ValueError via `raise ... from` or run parse directly to see the root cause (unrecognized pattern vs unrecognized unit).","Remove the hint if it is optional for your runner; hints are advisory."],"exampleFix":"// before\n--resource_hint=min_ram_mb=four-gigs\n// after\n--resource_hint=min_ram_mb=4GB","handlingStrategy":"try-catch","validationCode":"from apache_beam.transforms.resources import ResourceHint\nfor name, value in raw_hints.items():\n    if name in ResourceHint.get_registered_hint_names():\n        ResourceHint.get_by_name(name).parse(value)  # surface parse errors early","typeGuard":"def hint_value_parsable(name: str, value: str) -> bool:\n    try:\n        ResourceHint.get_by_name(name).parse(value)\n        return True\n    except (ValueError, KeyError):\n        return False","tryCatchPattern":"try:\n    hints = parse_resource_hints(raw_hints)\nexcept ValueError as e:\n    if 'invalid value' in str(e):\n        hint_name = str(e).split()[2]\n        log.error('Fix the format of resource hint %s', hint_name)\n    raise","preventionTips":["Check each hint's documented value format before adding it to pipeline options.","Test hint parsing in a unit test before shipping pipeline configs.","Pin Beam versions so hint formats don't change unexpectedly."],"tags":["python","apache-beam","resource-hints","value-format"],"backgroundTag":"invalid-config-value","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"}