apache/beam · error · NotImplementedError

ValueProvider.is_accessible implemented in derived classes

Error message

ValueProvider.is_accessible implemented in derived classes

What it means

ValueProvider is an abstract base class; is_accessible must be implemented by subclasses (StaticValueProvider, RuntimeValueProvider, etc.). Instantiating a custom ValueProvider without overriding is_accessible makes graph-construction code hit this NotImplementedError.

Solutions

  1. Override is_accessible() (and get()) in your ValueProvider subclass.
  2. Use StaticValueProvider or RuntimeValueProvider instead of subclassing from scratch.
  3. Call is_accessible only on concrete ValueProvider instances.

Example fix

# before
class MyVP(ValueProvider):
    pass
# after
class MyVP(ValueProvider):
    def is_accessible(self):
        return self._value is not None
    def get(self):
        return self._value
Defensive patterns

Strategy: try-catch

Validate before calling

if type(vp) is ValueProvider: raise TypeError('use a concrete ValueProvider subclass')

Type guard

def is_concrete_value_provider(vp) -> bool:
    return isinstance(vp, ValueProvider) and type(vp) is not ValueProvider and vp.is_accessible.__func__ is not ValueProvider.is_accessible

Try / catch

try:
    accessible = vp.is_accessible()
except NotImplementedError:
    accessible = True  # assume accessible for legacy providers

Prevention

When it happens

Trigger: Subclassing ValueProvider directly and not overriding is_accessible, then calling vp.is_accessible() at pipeline construction time.

Common situations: Writing a custom ValueProvider for deferred parameters and forgetting one of the abstract methods; or a library upgrade changing the interface.

Understand the failure class

Background: "NotImplementedError: Subclasses should override this method" / "must be implemented" — abstract method errors explained — this error's family across 40 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/options/value_provider.py:47

from apache_beam import error

__all__ = [
    'ValueProvider',
    'StaticValueProvider',
    'RuntimeValueProvider',
    'NestedValueProvider',
    'check_accessible',
]


class ValueProvider(object):
  """Base class that all other ValueProviders must implement.
  """
  def is_accessible(self):
    """Whether the contents of this ValueProvider is available to routines
    that run at graph construction time.
    """
    raise NotImplementedError(
        'ValueProvider.is_accessible implemented in derived classes')

  def get(self):
    """Return the value wrapped by this ValueProvider.
    """
    raise NotImplementedError(
        'ValueProvider.get implemented in derived classes')


class StaticValueProvider(ValueProvider):
  """StaticValueProvider is an implementation of ValueProvider that allows
  for a static value to be provided.
  """
  def __init__(self, value_type, value):
    """
    Args:
        value_type: Type of the static value
        value: Static value

View on GitHub (pinned to 12126d8942)