apache/beam · error · ValueError
Missing type specification in
Error message
Missing type specification in {identify_object(spec)} What it means
ensure_transforms_have_types runs during pipeline preprocessing to guarantee every transform spec carries a 'type' field, which is required for provider lookup and expansion. A transform without a type cannot be instantiated, so preprocessing fails fast with this ValueError identifying the offending spec.
Solutions
- Add the required 'type' field to the transform spec (e.g. type: MapToFields).
- Verify indentation so 'type' sits at the transform level, not nested under config.
- If the transform should be generic, check that a provider exists for the intended type and set type explicitly.
Example fix
# before
- name: my_map
config:
language: python
# after
- type: MapToFields
name: my_map
config:
language: python Defensive patterns
Strategy: validation
Validate before calling
for t in spec.get('transforms', []):
if 'type' not in t:
raise ValueError(f"transform {t.get('name')} is missing 'type'") Type guard
def has_type(t):
return isinstance(t, dict) and isinstance(t.get('type'), str) and bool(t['type'].strip()) Try / catch
try:
spec = ensure_transforms_have_types(spec)
except ValueError as e:
if 'Missing type specification' in str(e):
raise SystemExit(f'Fix your YAML: {e}')
raise Prevention
- Ensure every entry in the transforms list has a top-level type key
- Check YAML indentation so type is not nested under config
- Lint YAML pipelines against the Beam YAML schema before running
When it happens
Trigger: Applying ensure_transforms_have_types to a spec dict lacking a top-level 'type' key — e.g. a transform entry in the YAML transforms list that only has name/config/input/output.
Common situations: Hand-edited YAML dropping the type line; programmatically constructed specs forgetting the type; copy-paste of a composite's child entry without its type; indented YAML attaching type under config instead of at the transform level.
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
- Edge source and target cannot be empty
- HuggingFacePipelineModelHandler requires either 'task' or…
- Incompatible types: vs
- Missing config in ML transform spec
- Missing output in error_handling of
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/91507a8d55f1b34d.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/yaml/yaml_transform.py:1255
'type': 'Flatten',
'name': '%s-Flatten[%s]' % (t.get('name', t['type']), key),
'input': {
f'input{ix}': value
for (ix, value) in enumerate(values)
},
'__line__': spec['__line__'],
'__uuid__': flatten_id,
})
replaced_inputs[key] = flatten_id
if replaced_inputs:
t = dict(t, input={**t['input'], **replaced_inputs})
new_transforms.append(t)
return dict(spec, transforms=new_transforms)
def ensure_transforms_have_types(spec):
if 'type' not in spec:
raise ValueError(f'Missing type specification in {identify_object(spec)}')
return spec
def ensure_errors_consumed(spec):
if spec['type'] == 'composite':
scope = LightweightScope(spec['transforms'])
to_handle = {}
consumed = set(
scope.get_transform_id_and_output_name(output)
for output in spec['output'].values())
for t in spec['transforms']:
config = t.get('config', t)
if 'error_handling' in config:
if 'output' not in config['error_handling']:
raise ValueError(
f'Missing output in error_handling of {identify_object(t)}')
to_handle[t['__uuid__'], config['error_handling']['output']] = t
for _, input in empty_if_explicitly_empty(t['input']).items():View on GitHub (pinned to 12126d8942)