Nico Neumann

05/26/2023, 1:05 AM
I upgraded to the latest
version because of sqlalchemy 2.0 support. Thanks for the fast support there! 🚀 Now I have a problem with my custom block when I try to run my flows:
KeyError: "No class found for dispatch key 'my-custom-block' in registry for type 'Block'."
is installed and
is set. I’m using prefect cloud and the agent is updated to the latest version. I downgraded my prefect docker image to version 2.10.10 and it works fine again. Full log attached in the thread
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 310, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 191, in load_flow_from_flow_run
    storage_block = Block._from_block_document(storage_document)
  File "/usr/local/lib/python3.10/site-packages/prefect/blocks/", line 618, in _from_block_document
    else cls.get_block_class_from_schema(block_document.block_schema)
  File "/usr/local/lib/python3.10/site-packages/prefect/blocks/", line 672, in get_block_class_from_schema
    return cls.get_block_class_from_key(block_schema_to_key(schema))
  File "/usr/local/lib/python3.10/site-packages/prefect/blocks/", line 683, in get_block_class_from_key
    return lookup_type(cls, key)
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/", line 185, in lookup_type
    raise KeyError(
KeyError: "No class found for dispatch key 'my-custom-block' in registry for type 'Block'."
Minimal example of my Block:
class MyCustomBlock(S3Bucket):
    _block_type_name = "My Custom Block"
    _block_type_slug = "my-custom-block"

    async def put_directory(
        local_path: Optional[str] = None,
        to_path: Optional[str] = None,
        ignore_file: Optional[str] = None,
    ) -> int:
        # ...

    async def get_directory(self, from_path: Optional[str] = None, local_path: Optional[str] = None) -> None:
        # ...
I tried to fix it but was not able to do that. So I opened an issue with steps on how to reproduce it: