apache/beam · error · TypeError
Missing type parameter for transform at {identify_object(spe
Error message
Missing type parameter for transform at {identify_object(spec)} What it means
Apache Beam YAML raises this TypeError from expand_transform when a transform spec dict has no 'type' field. Every node in a Beam YAML pipeline must declare its transform type (e.g. 'ReadFromText', 'MapToFields', 'composite', 'chain'). Without it the framework cannot decide which expansion path (composite vs leaf) to take.
Source
Thrown at sdks/python/apache_beam/yaml/yaml_transform.py:478
strictness += 1
elif ('ExternalTransform' not in ptransform.label and
not ptransform.label.startswith('_')):
# The label may have interesting information.
name = ptransform.label
else:
name = spec['type']
if name in self._seen_names:
if strictness >= 2:
raise ValueError(f'Duplicate name at {identify_object(spec)}: {name}')
else:
name = f'{name}@{SafeLineLoader.get_line(spec)}'
self._seen_names.add(name)
return name
def expand_transform(spec, scope):
if 'type' not in spec:
raise TypeError(
f'Missing type parameter for transform at {identify_object(spec)}')
type = spec['type']
if type == 'composite':
return expand_composite_transform(spec, scope)
else:
return expand_leaf_transform(spec, scope)
def expand_leaf_transform(spec, scope):
spec = spec.copy()
# Check for optional output_schema to verify on.
# The idea is to pass this output_schema config to the ValidateWithSchema
# transform.
output_schema_spec = {}
if 'output_schema' in spec.get('config', {}):
output_schema_spec = spec.get('config').pop('output_schema')
View on GitHub (pinned to 12126d8942)
Solutions
- Add a 'type' key to the transform spec naming a valid Beam YAML transform type.
- Check YAML indentation so 'type:' is nested inside the transform mapping, not a sibling.
- Verify spelling/casing: the key must be exactly 'type' (lowercase).
- If generating specs in code, validate each spec dict contains 'type' before calling expand_transform.
Example fix
# before
- name: ReadInput
input: {}
config:
path: input.json
# after
- name: ReadInput
type: ReadFromJson
config:
path: input.json Defensive patterns
Strategy: validation
Validate before calling
def check_spec(spec):
if not isinstance(spec, dict) or 'type' not in spec:
raise ValueError(f"Transform spec missing required 'type' key: {spec}") Type guard
def has_type(spec) -> bool:
return isinstance(spec, dict) and isinstance(spec.get('type'), str) Try / catch
try:
expand_transform(spec, scope)
except TypeError as e:
if 'Missing type parameter' in str(e):
print(f"Fix YAML: {e}")
else:
raise Prevention
- Always include 'type:' as the first key in each YAML transform block.
- Run `python -m apache_beam.yaml.main --validate` or schema-validate specs in CI.
- Watch for YAML indentation that detaches 'type' from its mapping.
When it happens
Trigger: Calling expand_transform(spec, scope) — directly or via expand/compute_outputs — with a spec dict that omits the 'type' key, e.g. {'name': 'MyTransform', 'inputs': [...]} or a YAML stanza where 'type:' was mis-indented so it parsed into a sibling mapping instead of the transform.
Common situations: Hand-written YAML pipelines with a missing or misspelled 'type:' key (e.g. 'Type:' with capital T); programmatically constructed specs in tests or tools forgetting 'type'; YAML indentation errors that detach 'type' from its transform block.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Unknown enrichment source: {enrichment_handler}
- f'Unknown parameters {spec.keys()}'
- "Cannot specify 'callable' with 'path' and 'name' for functi
- error_handling config is not supported directly in the outpu
- Chain at {identify_object(spec)} missing transforms property
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/fa8e5cc372b8809c.
Report an issue: GitHub.