apache/beam · error · RuntimeError
You cannot turn on runtime_type_check and performance_runtim
Error message
You cannot turn on runtime_type_check and performance_runtime_type_check simultaneously. Pick one or the other.
What it means
Pipeline._run_internal rejects enabling both runtime_type_check and performance_runtime_type_check in TypeOptions, since they are two mutually exclusive runtime type-hint checking implementations (the eager checker vs. the cheaper sampled one). Enabling both is ambiguous, so a RuntimeError is raised.
Source
Thrown at sdks/python/apache_beam/pipeline.py:609
# runner API check should be skipped for such pipelines.
# The InteractiveRunner relies on a constant pipeline reference, skip
# it.
test_runner_api = (
not is_fnapi_compatible and
not self.contains_external_transforms and
self.runner.__class__.__name__ != 'InteractiveRunner')
# When possible, invoke a round trip through the runner API.
if test_runner_api and self._verify_runner_api_compatible():
return Pipeline.from_runner_api(
self.to_runner_api(use_fake_coders=True),
self.runner,
self._options).run(False)
if (self._options.view_as(TypeOptions).runtime_type_check and
self._options.view_as(TypeOptions).performance_runtime_type_check):
raise RuntimeError(
'You cannot turn on runtime_type_check '
'and performance_runtime_type_check simultaneously. '
'Pick one or the other.')
if self._options.view_as(TypeOptions).runtime_type_check:
from apache_beam.typehints import typecheck
self.visit(typecheck.TypeCheckVisitor())
if self._options.view_as(TypeOptions).performance_runtime_type_check:
from apache_beam.typehints import typecheck
self.visit(typecheck.PerformanceTypeCheckVisitor())
if self._options.view_as(SetupOptions).save_main_session:
# If this option is chosen, verify we can pickle the main session early.
tmpdir = tempfile.mkdtemp()
try:
pickler.dump_session(os.path.join(tmpdir, 'main_session.pickle'))
finally:View on GitHub (pinned to 12126d8942)
Solutions
- Remove one of the two flags from your PipelineOptions.
- Prefer --performance_runtime_type_check for lower overhead in most jobs.
- Check the environment/launcher scripts for a flag being injected automatically.
Example fix
// before PipelineOptions(['--runtime_type_check', '--performance_runtime_type_check']) // after PipelineOptions(['--performance_runtime_type_check'])
Defensive patterns
Strategy: validation
Validate before calling
from apache_beam.options.pipeline_options import TypeOptions opts = PipelineOptions(sys.argv[1:]) t = opts.view_as(TypeOptions) assert not (t.runtime_type_check and t.performance_runtime_type_check), 'pick one type check mode'
Prevention
- Enable only one type-check flag
- Centralize type-check flags in one config
- Audit launcher scripts for injected flags
When it happens
Trigger: Setting both flags simultaneously, typically via PipelineOptions(['--runtime_type_check', '--performance_runtime_type_check']) or by assigning both on TypeOptions before pipeline.run().
Common situations: Merging CLI flag sets from different scripts/docs; a default config already setting one flag while the user adds the other on the command line; copy-pasted option lists.
Related errors
- Timing number 0b" + timingNumber.toString(2) + " has more th
- Unknown PaneInfo encoding: " + encodingNibble
- Both a BigQuery table and a query were specified. Please spe
- Transform node %r was not replaced as expected.
- A transform with label "%s" already exists in the pipeline.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/5aa84f1529b66dd5.
Report an issue: GitHub.