apache/beam · warning

Please install jsonschema for better provider validation of

Error message

Please install jsonschema for better provider validation of "{type}"

What it means

When a YAML provider creates a transform of a given type, it validates the arguments against the provider's json_config_schema using jsonschema. If the jsonschema package is not installed, it catches ImportError, warns 'Please install jsonschema for better provider validation of "<type>"', and proceeds without validating args, so malformed configs will only fail later at runtime.

Solutions

  1. pip install jsonschema (or pip install apache-beam[yaml]) so validation runs.
  2. Re-run the pipeline; arg errors will now be caught up front with schema messages.
  3. Optionally add jsonschema to your deployment image/requirements to keep validation available.
  4. If you cannot install it, validate your YAML args manually against the provider's documented schema.

Example fix

// before
pip install apache-beam  # no jsonschema
// after
pip install 'apache-beam[yaml]'  # includes jsonschema
Defensive patterns

Strategy: fallback

Validate before calling

try:
    import jsonschema  # noqa: F401
    JSONSCHEMA_OK = True
except ImportError:
    JSONSCHEMA_OK = False

Try / catch

if JSONSCHEMA_OK:
    run_yaml_pipeline(spec)
else:
    print('jsonschema missing; YAML args will not be validated up front')

Prevention

When it happens

Trigger: Running a Beam YAML pipeline whose provider's create_transform is invoked in an environment where the optional jsonschema package is absent.

Common situations: Minimal installs of apache-beam[yaml] without extras, slim Docker images, or Airflow/managed environments lacking the optional validation dependency.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_provider.py:523

    return self._transforms[type].get(
        'requires_inputs', super().requires_inputs(type, args))

  def create_transform(
      self,
      type: str,
      args: Mapping[str, Any],
      yaml_create_transform: Callable[
          [Mapping[str, Any], Iterable[beam.PCollection]], beam.PTransform]
  ) -> beam.PTransform:
    from apache_beam.yaml.yaml_transform import SafeLineLoader
    from apache_beam.yaml.yaml_transform import expand_jinja
    from apache_beam.yaml.yaml_transform import preprocess
    spec = self._transforms[type]
    try:
      import jsonschema
      jsonschema.validate(args, self.json_config_schema(type))
    except ImportError:
      warnings.warn(
          'Please install jsonschema '
          f'for better provider validation of "{type}"')
    body = spec['body']
    # Stringify to apply jinja.
    if isinstance(body, str):
      body_str = body
    else:
      body_str = yaml.safe_dump(SafeLineLoader.strip_metadata(body))
    # Now re-parse resolved templatization.
    search_paths = [FileSystems.split(self._provider_base_path)[0]
                    ] if self._provider_base_path else []
    body = yaml.load(
        expand_jinja(body_str, args, search_paths), Loader=SafeLineLoader)
    if (body.get('type') == 'chain' and 'input' not in body and
        spec.get('requires_inputs', True)):
      body['input'] = 'input'
    return yaml_create_transform(preprocess(body))  # type: ignore

View on GitHub (pinned to 12126d8942)