{"record":{"id":"5aa84f1529b66dd5","repo":"apache/beam","slug":"you-cannot-turn-on-runtime-type-check-and-performance","errorCode":null,"errorMessage":"You cannot turn on runtime_type_check and performance_runtime_type_check simultaneously. Pick one or the other.","messagePattern":"You cannot turn on runtime_type_check and performance_runtime_type_check simultaneously\\. Pick one or the other\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/pipeline.py","lineNumber":609,"sourceCode":"        # runner API check should be skipped for such pipelines.\n\n        # The InteractiveRunner relies on a constant pipeline reference, skip\n        # it.\n        test_runner_api = (\n            not is_fnapi_compatible and\n            not self.contains_external_transforms and\n            self.runner.__class__.__name__ != 'InteractiveRunner')\n\n      # When possible, invoke a round trip through the runner API.\n      if test_runner_api and self._verify_runner_api_compatible():\n        return Pipeline.from_runner_api(\n            self.to_runner_api(use_fake_coders=True),\n            self.runner,\n            self._options).run(False)\n\n      if (self._options.view_as(TypeOptions).runtime_type_check and\n          self._options.view_as(TypeOptions).performance_runtime_type_check):\n        raise RuntimeError(\n            'You cannot turn on runtime_type_check '\n            'and performance_runtime_type_check simultaneously. '\n            'Pick one or the other.')\n\n      if self._options.view_as(TypeOptions).runtime_type_check:\n        from apache_beam.typehints import typecheck\n        self.visit(typecheck.TypeCheckVisitor())\n\n      if self._options.view_as(TypeOptions).performance_runtime_type_check:\n        from apache_beam.typehints import typecheck\n        self.visit(typecheck.PerformanceTypeCheckVisitor())\n\n      if self._options.view_as(SetupOptions).save_main_session:\n        # If this option is chosen, verify we can pickle the main session early.\n        tmpdir = tempfile.mkdtemp()\n        try:\n          pickler.dump_session(os.path.join(tmpdir, 'main_session.pickle'))\n        finally:","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/pipeline.py#L591-L627","documentation":"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.","triggerScenarios":"Setting both flags simultaneously, typically via PipelineOptions(['--runtime_type_check', '--performance_runtime_type_check']) or by assigning both on TypeOptions before pipeline.run().","commonSituations":"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.","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."],"exampleFix":"// before\nPipelineOptions(['--runtime_type_check', '--performance_runtime_type_check'])\n// after\nPipelineOptions(['--performance_runtime_type_check'])","handlingStrategy":"validation","validationCode":"from apache_beam.options.pipeline_options import TypeOptions\nopts = PipelineOptions(sys.argv[1:])\nt = opts.view_as(TypeOptions)\nassert not (t.runtime_type_check and t.performance_runtime_type_check), 'pick one type check mode'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable only one type-check flag","Centralize type-check flags in one config","Audit launcher scripts for injected flags"],"tags":["python","apache-beam","runtime-error","type-checking","mutually-exclusive"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}