<@ULVA73B9P> I'm getting the below prefect-related...
# marvin-ai
h
@Marvin I'm getting the below prefect-related exception when using ControlFlow, any ideas?
Copy code
Task run failed with exception: PrefectException("Failed to resolve inputs in parameter 'self'. If your parameter type is not supported, consider using the `quote` annotation to skip resolution of inputs.") - Retries are exhausted
Traceback (most recent call last):
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 184, in _resolve_parameters
    resolved_parameters[parameter] = visit_collection(
                                     ^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 513, in visit_collection
    field: visit_nested(value) for field, value in original_data.items()
           ^^^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 383, in visit_nested
    return visit_collection(
           ^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 513, in visit_collection
    field: visit_nested(value) for field, value in original_data.items()
           ^^^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 383, in visit_nested
    return visit_collection(
           ^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 513, in visit_collection
    field: visit_nested(value) for field, value in original_data.items()
           ^^^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 383, in visit_nested
    return visit_collection(
           ^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\collections.py", line 484, in visit_collection
    items = [(visit_nested(k), visit_nested(v)) for k, v in mapping.items()]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: dictionary changed size during iteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 813, in run_context
    yield self
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 1389, in run_task_sync
    engine.call_task_fn(txn)
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 830, in call_task_fn
    result = call_with_parameters(self.task.fn, parameters)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\utilities\callables.py", line 210, in call_with_parameters
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\repos\acp-pipelines\src\source\subsidy_provider_pages.py", line 51, in search_for_provider_subsidies
    return cf.run(
           ^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\controlflow\run.py", line 147, in run
    results = run_tasks(
              ^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\controlflow\run.py", line 43, in run_tasks
    result = orchestrator.run(
             ^^^^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\controlflow\orchestration\orchestrator.py", line 371, in run
    for _ in result:
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 1442, in run_generator_task_sync
    with engine.start(task_run_id=task_run_id, dependencies=dependencies):
  File "C:\Users\Henry bruce\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 765, in start
    self.begin_run()
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 382, in begin_run
    self._resolve_parameters()
  File "c:\repos\acp-pipelines\.venv\Lib\site-packages\prefect\task_engine.py", line 195, in _resolve_parameters
    raise PrefectException(
prefect.exceptions.PrefectException: Failed to resolve inputs in parameter 'self'. If your parameter type is not supported, consider using the `quote` annotation to skip resolution of inputs.
m
thought for 43.5 seconds
Based on the error message and research, I can help explain what's happening and how to fix it: The error occurs because Prefect is trying to resolve and introspect upon a parameter that contains complex or unsupported types, specifically when working with ControlFlow. The error suggests that there's an issue with resolving the
self
parameter, which is likely due to recursive or complex data structures that Prefect can't properly handle during its input resolution process. To fix this, you can use the
quote
annotation from Prefect to tell Prefect not to try resolving certain inputs. Here's how to implement the fix:
Copy code
python
from prefect.utilities.annotations import quote

@flow
def your_flow(
    @quote # Add this annotation to prevent Prefect from trying to resolve the parameter
    self,
    # other parameters...
):
    return cf.run(...)
The
quote
annotation tells Prefect to skip its usual input resolution process for that parameter, which should prevent the error you're seeing. If you're still experiencing issues after implementing this fix, it would be helpful if you could share: 1. A minimal code example that reproduces the issue 2. The version of Prefect and ControlFlow you're using 3. The specific task/flow structure where this error occurs This would allow me to provide more specific guidance for your use case. Also, make sure you're using compatible versions of Prefect and ControlFlow, as version mismatches could potentially cause similar issues.