{"record":{"id":"10d1361d53ce81ec","repo":"apache/beam","slug":"notimplementederror-request-artifact-type-urn","errorCode":null,"errorMessage":"NotImplementedError(request.artifact.type_urn)","messagePattern":"NotImplementedError\\(request\\.artifact\\.type_urn\\)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/artifact_service.py","lineNumber":83,"sourceCode":"        replacements=request.artifacts)\n\n  def GetArtifact(self, request, context=None):\n    if request.artifact.type_urn == common_urns.artifact_types.FILE.urn:\n      payload = proto_utils.parse_Bytes(\n          request.artifact.type_payload,\n          beam_runner_api_pb2.ArtifactFilePayload)\n      read_handle = self._file_reader(payload.path)\n    elif request.artifact.type_urn == common_urns.artifact_types.URL.urn:\n      payload = proto_utils.parse_Bytes(\n          request.artifact.type_payload, beam_runner_api_pb2.ArtifactUrlPayload)\n      read_handle = urlopen(payload.url)\n    elif request.artifact.type_urn == common_urns.artifact_types.EMBEDDED.urn:\n      payload = proto_utils.parse_Bytes(\n          request.artifact.type_payload,\n          beam_runner_api_pb2.EmbeddedFilePayload)\n      read_handle = BytesIO(payload.data)\n    else:\n      raise NotImplementedError(request.artifact.type_urn)\n\n    with read_handle as fin:\n      while True:\n        chunk = fin.read(self._chunk_size)\n        if not chunk:\n          break\n        yield beam_artifact_api_pb2.GetArtifactResponse(data=chunk)\n\n\nclass ArtifactStagingService(\n    beam_artifact_api_pb2_grpc.ArtifactStagingServiceServicer):\n  def __init__(\n      self,\n      file_writer: Callable[[str, Optional[str]], tuple[BinaryIO, str]],\n  ):\n    self._lock = threading.Lock()\n    self._jobs_to_stage: dict[\n        str,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/artifact_service.py#L65-L101","documentation":"In the artifact staging service, GetArtifact opens a read handle based on the artifact's type_urn; only FILE and EMBEDDED urns are handled, anything else raises NotImplementedError. The requested artifact type is not supported by this implementation.","triggerScenarios":"Calling the GetArtifact RPC with an artifact whose type_urn is neither FILEArtifactPayload nor EmbeddedFilePayload — e.g. a URL-based or custom artifact type produced by another service.","commonSituations":"SDK/job-service version skew with divergent artifact type urns; artifacts staged by a third-party or custom staging service; portable pipeline cross-version mismatches.","solutions":["Stage the artifact as a FILE or EMBEDDED type supported by this service.","Align SDK and job-service versions so both agree on artifact type urns.","Subclass ArtifactStagingService and override GetArtifact if a custom artifact type is genuinely required."],"exampleFix":"// before\nartifact.type_urn = 'beam:artifact:type:custom:v1'\n// after\nartifact.type_urn = common_urns.artifact_types.FILE.urn\nartifact.type_payload = beam_runner_api_pb2.FileArtifactPayload(\n    path='/tmp/artifact.txt').SerializeToString()","handlingStrategy":"validation","validationCode":"from apache_beam.portability.common_urns import artifact_types\n\nassert artifact.type_urn in (\n    artifact_types.FILE.urn, artifact_types.EMBEDDED.urn), \\\n    f\"unsupported artifact type: {artifact.type_urn}\"","typeGuard":"def is_supported_artifact(artifact) -> bool:\n    return artifact.type_urn in (\n        common_urns.artifact_types.FILE.urn,\n        common_urns.artifact_types.EMBEDDED.urn)","tryCatchPattern":"try:\n    for chunk in stub.GetArtifact(req):\n        consume(chunk)\nexcept NotImplementedError:\n    restage_artifact_as_file(artifact)  # convert custom type to FILE","preventionTips":["Stage artifacts only with FILE or EMBEDDED type urns.","Keep SDK and job-service versions aligned to avoid urn skew.","Log artifact.type_urn when staging so mismatches are diagnosable."],"tags":["python","apache-beam","artifact-staging","not-implemented"],"backgroundTag":"method-not-implemented","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"}