apache/beam · error · ValueError

Unsupported type

Error message

Unsupported type: {primitive_type}

What it means

get_type_color maps schema primitive type strings to HTML colors for the generated managed-transform documentation. Types outside the known set (string, int*, boolean, etc.) fall through and raise ValueError('Unsupported type: ...').

Solutions

  1. Check the type string in the config for typos and correct it.
  2. Add an elif branch to get_type_color in gen_managed_doc.py returning a color for the new primitive type.
  3. Re-run the doc generator.

Example fix

// before (gen_managed_doc.py)
  elif primitive_type == "boolean":
    return "orange"
// after
  elif primitive_type == "boolean":
    return "orange"
  elif primitive_type.startswith("bytes"):
    return "purple"
Defensive patterns

Strategy: try-catch

Validate before calling

SUPPORTED = {'string', 'boolean', 'integer', 'int64', 'int32', 'double', 'float', 'bytes'}
for f in config_fields:
    assert f['type'] in SUPPORTED or f['type'].startswith(('int', 'map')), f['type']

Type guard

def is_supported_primitive(t):
    return isinstance(t, str) and (t in SUPPORTED or t.startswith(('int', 'map')))

Try / catch

try:
    html = get_type_format_html(field_type)
except ValueError as e:
    print(f'Add a color mapping for this type: {e}')

Prevention

When it happens

Trigger: A config field in the documented manifest declares a primitive type string not handled by get_type_color's if/elif chain (e.g. a new or misspelled type) while rendering type-format HTML.

Common situations: Adding a new Beam managed config with a novel field type without updating the doc generator; a typo like 'strings' instead of 'string'.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/ad6b01e996461ffd. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/gen_managed_doc.py:318

  if documented:
    return field_name in documented
  else:  # ignored
    return field_name not in ignored


def spaces(n: int):
  return " " * n


def get_type_color(primitive_type: str):
  if primitive_type == "str":
    return "green"
  elif primitive_type.startswith("int"):
    return "#f54251"
  elif primitive_type == "boolean":
    return "orange"

  raise ValueError("Unsupported type: " + primitive_type)


def get_type_format_html(type: str, with_paranthesis: bool):
  if type.startswith("map"):
    regex = r"map\[(.*?),\s*(.*?)\]"
    match = re.search(regex, type)
    key_type = match.group(1)
    value_type = match.group(2)
    key_color = get_type_color(key_type)
    value_color = get_type_color(value_type)
    html_type = (
        '<code>map['
        f'<span style="color: {key_color};">{key_type}</span>, '
        f'<span style="color: {value_color};">{value_type}</span>]'
        '</code>')
  elif type.startswith("list"):
    regex = r"list\[(.*?)\]"
    match = re.search(regex, type)

View on GitHub (pinned to 12126d8942)