im using web3.py v5.19 in my project and we are on BSC mainnet also i use bsc urls recommended in site to connect to nodes this is my code to get events :

block_filter1 = contract.events.validatorSuggested.createFilter(fromBlock='latest')
for event in filter.get_new_entries():
                if event.event == 'validatorSuggested' : 

but after a while i got this error :

File "/usr/local/lib/python3.8/dist-packages/web3/_utils/filters.py", line 160, in get_new_entries
    log_entries = self._filter_valid_entries(self.eth_module.get_filter_changes(self.filter_id))
  File "/usr/local/lib/python3.8/dist-packages/web3/module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str, params, error_formatters)
  File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 158, in request_blocking
    raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'filter not found'}

as i searched , the problem comes from '' stateless '' nodes which clear filters . what should i do exactly in order to solve this problem and receive events ?


1 Answer 1


I had the same issue and I switched to a websocket rpc instead of an HTTP one and it started to work that way

  • great! this helped me a lot. I'll have to do more test, but I think your answer should be accepted as the correct answer. Apr 29 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.