apache/beam · error · ValueError
Resource hint has invalid value .
Error message
Resource hint {hint} has invalid value {value}. What it means
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.
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.
Example fix
// before --resource_hint=min_ram_mb=four-gigs // after --resource_hint=min_ram_mb=4GB
Defensive patterns
Strategy: try-catch
Validate before calling
from apache_beam.transforms.resources import ResourceHint
for name, value in raw_hints.items():
if name in ResourceHint.get_registered_hint_names():
ResourceHint.get_by_name(name).parse(value) # surface parse errors early Type guard
def hint_value_parsable(name: str, value: str) -> bool:
try:
ResourceHint.get_by_name(name).parse(value)
return True
except (ValueError, KeyError):
return False Try / catch
try:
hints = parse_resource_hints(raw_hints)
except ValueError as e:
if 'invalid value' in str(e):
hint_name = str(e).split()[2]
log.error('Fix the format of resource hint %s', hint_name)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unrecognized value pattern.
- Input must be a string.
- Input must be a string or integer.
- Input must be an integer.
- Unknown resource hint
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6bb56b0be2e685de.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/transforms/resources.py:225
# Alias for interoperability with SDKs preferring camelCase.
ResourceHint.register_resource_hint(
'MaxActiveBundlesPerWorker', MaxActiveBundlesPerWorkerHint)
# Alias for common typo.
ResourceHint.register_resource_hint(
'max_active_bundle_per_worker', MaxActiveBundlesPerWorkerHint)
ResourceHint.register_resource_hint(
'MaxActiveBundlePerWorker', MaxActiveBundlesPerWorkerHint)
def parse_resource_hints(hints: dict[Any, Any]) -> dict[str, bytes]:
parsed_hints = {}
for hint, value in hints.items():
try:
hint_cls = ResourceHint.get_by_name(hint)
try:
parsed_hints.update(hint_cls.parse(value))
except ValueError:
raise ValueError(f"Resource hint {hint} has invalid value {value}.")
except KeyError:
raise ValueError(f"Unknown resource hint: {hint}.")
return parsed_hints
def resource_hints_from_options(
options: Optional[PipelineOptions]) -> dict[str, bytes]:
if options is None:
return {}
hints = {}
option_specified_hints = options.view_as(StandardOptions).resource_hints
if isinstance(option_specified_hints, dict):
return parse_resource_hints(option_specified_hints)
for hint in option_specified_hints:
if '=' in hint:View on GitHub (pinned to 12126d8942)