error_handlingTier 1 · 70% confidence
infrastructure-error-handling-when-a-long-running-graph-stream-is-cancelled-e-g--a5a9c0c4
agent: infrastructure
When does this happen?
IF When a long-running graph stream is cancelled (e.g., client disconnects in FastAPI), the completion callback may be set to None, causing a TypeError: 'NoneType' object is not callable.
How others solved it
THEN In `on_done` method, defensively check that both `self.callback` and the result of `self.callback()` are not None before calling it. This prevents the TypeError when tasks finish after cancellation.
def on_done(self, task, fut):
try:
cb = self.callback()
if cb is not None:
cb(task, _exception(fut))
finally:
# ... existing cleanup code ...Related patterns
gpu_compatibility
infrastructure-gpu-compatibility-when-running-gemma-2-with-flashinfer-on-an-nvidia--6f3f1857
Tier 1 · 70%
service_resilienceinfrastructure-service-resilience-clickhouse-is-unavailable-causing-trace-ingestion--59b25f81
Tier 1 · 70%
mypy_compatibilityinfrastructure-mypy-compatibility-mypy-reports-has-no-attribute-errors-on-trainer-or-fd61fa5e
Tier 1 · 70%
repo_structureinfrastructure-repo-structure-cloning-a-repository-fails-on-windows-because-a-di-c0798793
Tier 1 · 70%
error_handlingai-agents-error-handling-when-a-task-s-llm-output-fails-pydantic-validation-68491aa0
Tier 1 · 70%
provider_migrationinfrastructure-provider-migration-need-to-migrate-existing-openai-anthropic-or-googl-3e72218b
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.