apache/beam · error · ValueError

Unable to parse binary URL

Error message

Unable to parse binary URL "%s". If using a full URL, make sure the scheme is specified. If using a local file xpath, make sure the file exists; you may have to first build prism using `go build `.

What it means

_resolve_from_location_override interprets the --prism_location value as either a URL or a local file path. When urllib.parse finds no scheme, it treats the value as a local path; if parsing/lookup fails this ValueError is raised asking you to either give a scheme-bearing URL or a valid existing file path.

Solutions

  1. Prepend the scheme to the URL: --prism_location=https://github.com/... .
  2. If it is a local binary, verify the file exists (ls) and pass the full path without a scheme.
  3. Build prism first with `go build` so the referenced local path exists.

Example fix

// before
--prism_location=github.com/apache/beam/releases/download/v2.66.0/prism.zip
// after
--prism_location=https://github.com/apache/beam/releases/download/v2.66.0/prism.zip
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse
import os
path = prism_location
u = urlparse(path)
if not u.scheme and not os.path.isfile(path):
    raise SystemExit(f'--prism_location {path!r}: add a URL scheme or point at an existing prism binary')

Prevention

When it happens

Trigger: Passing --prism_location with a URL missing its scheme (e.g. 'github.com/.../file.zip' or '//host/path') or a typo'd/nonexistent local path to a prism binary.

Common situations: Omitting 'https://' when pasting a release URL; using 'file://' incorrectly or pointing at a path that does not exist yet before building prism with `go build`.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/19c848ed74ef140e. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/runners/portability/prism_runner.py:368

    """Handles the case where --prism_location is explicitly set."""
    # The path is overridden, check various cases.
    if os.path.exists(path):
      # The path is local and exists, use directly.
      return path

    try:
      if FileSystems.exists(path):
        # The path is in one of the supported filesystems.
        return path
    except ValueError:
      # If there is a value error raised by Filesystems, try to resolve
      # the path with the following steps.
      pass

    # Check if the path is a URL.
    url = urllib.parse.urlparse(path)
    if not url.scheme:
      raise ValueError(
          'Unable to parse binary URL "%s". If using a full URL, make '
          'sure the scheme is specified. If using a local file xpath, '
          'make sure the file exists; you may have to first build prism '
          'using `go build `.' % (path))

    # We have a URL, see if we need to construct a valid file name.
    if path.startswith(GITHUB_DOWNLOAD_PREFIX):
      # If this URL starts with the download prefix, let it through.
      return path
    # The only other valid option is a github release page.
    if not path.startswith(GITHUB_TAG_PREFIX):
      raise ValueError(
          'Provided --prism_location URL is not an Apache Beam Github '
          'Release page URL or download URL: %s' % (path))
    # Get the root tag for this URL
    root_tag = os.path.basename(os.path.normpath(path))
    return PrismJobServer._construct_download_url(
        version, root_tag, platform.system(), platform.machine())

View on GitHub (pinned to 12126d8942)