{"record":{"id":"e55dbd110d7e1a51","repo":"apache/beam","slug":"f-invalid-path-or-url-jar","errorCode":null,"errorMessage":"f'Invalid path or url: {jar}'","messagePattern":"f'Invalid path or url: (.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_provider.py","lineNumber":313,"sourceCode":"      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):\n  if not os.path.exists(jar):\n    parsed = urllib.parse.urlparse(jar)\n    if not parsed.scheme or not parsed.netloc:\n      raise ValueError(f'Invalid path or url: {jar}')\n  return ExternalJavaProvider(\n      urns, lambda: _join_url_or_filepath(provider_base_path, jar))\n\n\n@ExternalProvider.register_provider_type('mavenJar')\ndef maven_jar(\n    urns,\n    *,\n    artifact_id,\n    group_id,\n    version,\n    repository=subprocess_server.JavaJarServer.MAVEN_CENTRAL_REPOSITORY,\n    classifier=None,\n    appendix=None):\n  return ExternalJavaProvider(\n      urns, lambda: subprocess_server.JavaJarServer.path_to_maven_jar(\n          artifact_id=artifact_id, group_id=group_id, version=version,\n          repository=repository, classifier=classifier, appendix=appendix))","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_provider.py#L295-L331","documentation":"java_jar (yaml_provider.py:313), the 'javaJar' provider type constructor, accepts a jar that must be either an existing local file path or a URL with both scheme and netloc. If the jar path does not exist and does not parse as a full URL, it raises ValueError 'Invalid path or url'.","triggerScenarios":"Passing jar: 'my-lib.jar' when the file doesn't exist relative to the working directory; passing a bare hostname or scheme-less path like 'example.com/lib.jar'; typos in a local absolute path.","commonSituations":"Running the pipeline from a different cwd than where the jar lives; forgetting file:// or https:// on a remote jar; backslashes or spaces in Windows paths.","solutions":["Give an absolute path to the jar or run the pipeline from the directory containing it.","Use a full URL including scheme and host, e.g. https://host/path/lib.jar or file:///path/lib.jar.","Verify existence first: os.path.exists(jar) in the launching environment; remember provider_base_path is joined later via _join_url_or_filepath."],"exampleFix":"# before\n- type: javaJar\n  config:\n    jar: example.com/lib.jar\n# after\n- type: javaJar\n  config:\n    jar: https://example.com/lib.jar","handlingStrategy":"validation","validationCode":"import os, urllib.parse\ndef validate_jar(jar):\n    if os.path.exists(jar):\n        return\n    p = urllib.parse.urlparse(jar)\n    if not p.scheme or not p.netloc:\n        raise SystemExit(f'jar must be an existing file or full URL: {jar}')","typeGuard":null,"tryCatchPattern":"try:\n    provider = ExternalProvider.provider_from_spec(src, spec)\nexcept ValueError as e:\n    log.error('javaJar config problem: %s', e)\n    raise","preventionTips":["Use absolute paths for local jars or full URLs with scheme and host.","Run pipelines from a known working directory or resolve jar paths at spec-generation time.","Verify jar reachability (os.path.exists / HTTP HEAD) before launching."],"tags":["python","apache-beam","yaml","jar","path"],"backgroundTag":"invalid-url","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"}