{"record":{"id":"648712c92f03638c","repo":"apache/beam","slug":"valueprovider-get-implemented-in-derived-classes","errorCode":null,"errorMessage":"ValueProvider.get implemented in derived classes","messagePattern":"ValueProvider\\.get implemented in derived classes","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/options/value_provider.py","lineNumber":53,"sourceCode":"    'NestedValueProvider',\n    'check_accessible',\n]\n\n\nclass ValueProvider(object):\n  \"\"\"Base class that all other ValueProviders must implement.\n  \"\"\"\n  def is_accessible(self):\n    \"\"\"Whether the contents of this ValueProvider is available to routines\n    that run at graph construction time.\n    \"\"\"\n    raise NotImplementedError(\n        'ValueProvider.is_accessible implemented in derived classes')\n\n  def get(self):\n    \"\"\"Return the value wrapped by this ValueProvider.\n    \"\"\"\n    raise NotImplementedError(\n        'ValueProvider.get implemented in derived classes')\n\n\nclass StaticValueProvider(ValueProvider):\n  \"\"\"StaticValueProvider is an implementation of ValueProvider that allows\n  for a static value to be provided.\n  \"\"\"\n  def __init__(self, value_type, value):\n    \"\"\"\n    Args:\n        value_type: Type of the static value\n        value: Static value\n    \"\"\"\n    self.value_type = value_type\n    self.value = value_type(value)\n\n  def is_accessible(self):\n    return True","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/options/value_provider.py#L35-L71","documentation":"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.","triggerScenarios":"Instantiating ValueProvider() directly and calling .get(), or a subclass that overrides is_accessible but not get.","commonSituations":"Custom ValueProvider implementations missing the get method; refactors leaving a stub that still calls the base class.","solutions":["Implement get() in the subclass to return the stored value.","Use StaticValueProvider(value) or RuntimeValueProvider for standard cases.","Add get to any ValueProvider subclass created before this method was required."],"exampleFix":"# before\nclass ConfigVP(ValueProvider):\n    def is_accessible(self):\n        return True\n# after\nclass ConfigVP(ValueProvider):\n    def is_accessible(self):\n        return True\n    def get(self):\n        return self._value","handlingStrategy":"try-catch","validationCode":"if getattr(vp.get, '__isabstractmethod__', False): raise TypeError('ValueProvider subclass must implement get()')","typeGuard":"def has_get(vp) -> bool:\n    return callable(getattr(vp, 'get', None)) and not getattr(vp.get, '__isabstractmethod__', False)","tryCatchPattern":"try:\n    value = vp.get()\nexcept NotImplementedError:\n    value = fallback_value","preventionTips":["Implement both is_accessible and get in every ValueProvider subclass.","Prefer built-in StaticValueProvider/RuntimeValueProvider implementations."],"tags":["apache-beam","python","abstract-method"],"backgroundTag":"abstract-method-not-implemented","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"}