apache/beam · error · NotImplementedError

ValueProvider.get implemented in derived classes

Error message

ValueProvider.get implemented in derived classes

What it means

This is the abstract ValueProvider base class's sentinel: get() is deliberately unimplemented and any call reaching it means a derived ValueProvider failed to override get(). It signals a subclassing bug, not bad user input.

Solutions

  1. Implement get() in the subclass to return the stored value.
  2. Use StaticValueProvider(value) or RuntimeValueProvider for standard cases.
  3. Add get to any ValueProvider subclass created before this method was required.

Example fix

# before
class ConfigVP(ValueProvider):
    def is_accessible(self):
        return True
# after
class ConfigVP(ValueProvider):
    def is_accessible(self):
        return True
    def get(self):
        return self._value
Defensive patterns

Strategy: try-catch

Validate before calling

if getattr(vp.get, '__isabstractmethod__', False): raise TypeError('ValueProvider subclass must implement get()')

Type guard

def has_get(vp) -> bool:
    return callable(getattr(vp, 'get', None)) and not getattr(vp.get, '__isabstractmethod__', False)

Try / catch

try:
    value = vp.get()
except NotImplementedError:
    value = fallback_value

Prevention

When it happens

Trigger: Instantiating ValueProvider() directly and calling .get(), or a subclass that overrides is_accessible but not get.

Common situations: Custom ValueProvider implementations missing the get method; refactors leaving a stub that still calls the base class.

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/648712c92f03638c. Report an issue: GitHub.

Appendix: source

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

    '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
    """
    self.value_type = value_type
    self.value = value_type(value)

  def is_accessible(self):
    return True

View on GitHub (pinned to 12126d8942)