{"record":{"id":"11496dec42b2d103","repo":"apache/beam","slug":"unknown-role-type-s","errorCode":null,"errorMessage":"unknown role type: %s","messagePattern":"unknown role type: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/stager.py","lineNumber":164,"sourceCode":"\n  @staticmethod\n  def extract_staging_tuple_iter(\n      artifacts: list[beam_runner_api_pb2.ArtifactInformation]):\n    for artifact in artifacts:\n      if artifact.type_urn == common_urns.artifact_types.FILE.urn:\n        file_payload = beam_runner_api_pb2.ArtifactFilePayload()\n        file_payload.ParseFromString(artifact.type_payload)\n        src = file_payload.path\n        sha256 = file_payload.sha256\n        if artifact.role_urn == common_urns.artifact_roles.STAGING_TO.urn:\n          role_payload = beam_runner_api_pb2.ArtifactStagingToRolePayload()\n          role_payload.ParseFromString(artifact.role_payload)\n          dst = role_payload.staged_name\n        elif (artifact.role_urn ==\n              common_urns.artifact_roles.PIP_REQUIREMENTS_FILE.urn):\n          dst = hashlib.sha256(artifact.SerializeToString()).hexdigest()\n        else:\n          raise RuntimeError(\"unknown role type: %s\" % artifact.role_urn)\n        yield (src, dst, sha256)\n      else:\n        raise RuntimeError(\"unknown artifact type: %s\" % artifact.type_urn)\n\n  @staticmethod\n  def create_job_resources(\n      options: PipelineOptions,\n      temp_dir: str,\n      build_setup_args: Optional[list[str]] = None,\n      pypi_requirements: Optional[list[str]] = None,\n      populate_requirements_cache: Optional[Callable[[str, str, bool],\n                                                     None]] = None,\n      skip_prestaged_dependencies: Optional[bool] = False,\n      log_submission_env_dependencies: Optional[bool] = True,\n  ):\n    \"\"\"For internal use only; no backwards-compatibility guarantees.\n\n        Creates (if needed) a list of job resources.","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/stager.py#L146-L182","documentation":"While building the staging resources for a portable job, Stager.extract_staging_tuple_iter maps each artifact's role URN to a destination name (STAGED_FILE uses role_payload.staged_name, PIP_REQUIREMENTS_FILE uses a hash). Any other role URN is unsupported by the Python stager and raises RuntimeError with the raw URN.","triggerScenarios":"An artifact with a role URN other than STAGED_FILE or PIP_REQUIREMENTS_FILE arrives in the artifact list — e.g. a runner/SDK or custom pipeline emits new role types the Python stager does not know.","commonSituations":"Custom artifact roles injected by an extension or internal pipeline; SDK/runner version mismatch where a newer role URN is sent to an older Python stager; hand-crafted RunnerAPI protos in tests or tooling.","solutions":["Identify the offending role_urn from the error message and remove or convert that artifact at the source.","Upgrade apache-beam on the submitting side so both SDK and stager agree on known role URNs.","If it is your extension emitting the role, stage the artifact via a supported role (STAGED_FILE with role_payload.staged_name).","Check for mixed Beam versions between the job submission components (Runner harness vs stager)."],"exampleFix":"// before\nartifact.role_urn = common_urns.artifact_roles.OTHER_ROLE.urn  # unsupported\n// after\nrole_payload = beam_runner_api_pb2.ArtifactStagingToTargetPayload()\nrole_payload.staged_name = 'my_staged_file.txt'\nartifact.role_urn = common_urns.artifact_roles.STAGED_FILE.urn\nartifact.role_payload = role_payload.SerializeToString()","handlingStrategy":"validation","validationCode":"from apache_beam.runners.portability import common_urns\nfor a in artifacts:\n    if a.role_urn not in {\n        common_urns.artifact_roles.STAGED_FILE.urn,\n        common_urns.artifact_roles.PIP_REQUIREMENTS_FILE.urn,\n    }:\n        raise SystemExit(f'Unsupported artifact role: {a.role_urn}')","typeGuard":null,"tryCatchPattern":"try:\n    resources = Stager.create_job_resources(options, tmpdir)\nexcept RuntimeError as e:\n    if e.args and e.args[0].startswith('unknown role type:'):\n        report_bad_artifact(e.args[0].split(': ', 1)[1])\n    else:\n        raise","preventionTips":["Keep SDK versions aligned between submitter and stager","Emit only STAGED_FILE/PIP_REQUIREMENTS_FILE roles from custom tooling","Log artifact URNs when building pipelines for staging"],"tags":["apache-beam","staging","artifacts","protobuf"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}