{"record":{"id":"efeb5677323640c6","repo":"apache/beam","slug":"unable-to-instantiate-provider-of-type-type-at-line","errorCode":null,"errorMessage":"Unable to instantiate provider of type {type} at line {SafeLineLoader.get_line(spec)}: {exn}","messagePattern":"Unable to instantiate provider of type (.+?) at line (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_provider.py","lineNumber":291,"sourceCode":"        'transforms', 'type', 'config'\n    }\n    if extra_params:\n      raise ValueError(\n          f'Unexpected parameters in provider of type {type} '\n          f'at line {SafeLineLoader.get_line(spec)}: {extra_params}')\n    if config.get('version', None) == 'BEAM_VERSION':\n      config['version'] = beam_version\n    if type in cls._provider_types:\n      try:\n        constructor = cls._provider_types[type]\n        if 'provider_base_path' in inspect.signature(constructor).parameters:\n          config['provider_base_path'] = source_path\n        result = constructor(urns, **config)\n        if not hasattr(result, 'to_json'):\n          result.to_json = lambda: spec\n        return result\n      except Exception as exn:\n        raise ValueError(\n            f'Unable to instantiate provider of type {type} '\n            f'at line {SafeLineLoader.get_line(spec)}: {exn}') from exn\n    else:\n      raise NotImplementedError(\n          f'Unknown provider type: {type} '\n          f'at line {SafeLineLoader.get_line(spec)}.')\n\n  @classmethod\n  def register_provider_type(cls, type_name):\n    def apply(constructor):\n      cls._provider_types[type_name] = constructor\n      return constructor\n\n    return apply\n\n\n@ExternalProvider.register_provider_type('javaJar')\ndef java_jar(urns, provider_base_path, jar: str):","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_provider.py#L273-L309","documentation":"After passing validation, provider_from_spec calls the registered constructor as constructor(urns, **config). Any exception raised there is re-raised as a ValueError 'Unable to instantiate provider of type ... at line ...' with the original exception chained (from exn), so the underlying cause appears in the traceback.","triggerScenarios":"A registered provider type whose constructor fails on the given config: bad jar path handling setup, invalid config values (wrong types, missing constructor kwargs), network/IO errors resolving the provider.","commonSituations":"maven/java jar provider configs with wrong coordinates; python provider config referencing modules that fail to import at construction; version strings that don't resolve.","solutions":["Read the chained ': {exn}' cause in the message/traceback and fix that underlying error.","Check each config key matches the provider constructor's expected parameters and types.","Verify any referenced artifacts (jars, urls) are reachable from the launching machine.","If the constructor has a bug, file/inspect in apache_beam.yaml.yaml_provider for that provider type."],"exampleFix":"# before\n- type: mavenJar\n  config:\n    jar: not-a-coordinate\n# after\n- type: mavenJar\n  config:\n    group_id: org.example\n    artifact_id: my-lib\n    version: 1.0.0","handlingStrategy":"try-catch","validationCode":"# Pre-check constructor kwargs where possible\nrequired = {'jar'}  # example for javaJar\nif not required.issubset(spec.get('config', {})):\n    raise SystemExit(f'config missing keys: {required - set(spec.get(\"config\", {}))}')","typeGuard":null,"tryCatchPattern":"try:\n    provider = ExternalProvider.provider_from_spec(src, spec)\nexcept ValueError as e:\n    log.error('Provider instantiation failed: %s', e)\n    log.error('Cause: %s', e.__cause__)\n    raise","preventionTips":["Always inspect the chained cause (__cause__) for the real failure.","Validate jar paths/URLs and maven coordinates before launching.","Test provider specs with a minimal pipeline first."],"tags":["python","apache-beam","yaml","provider","instantiation"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}