`ValueError: Duplicated timeseries in CollectorRegistry: {'requests_total', 'requests_created', 'requests'}`
IntermediateTroubleshootingConcurrency, async, tests, services & containers
Answer
Likely causes → The same metric is registered twice: module imported twice under different names, metric defined inside a function or app factory that runs more than once, or tests creating the app repeatedly.
Diagnose → Find where the metric is constructed and how often that code runs.
Fix → Define metrics once at module level; in app factories or tests, pass a dedicated CollectorRegistry() per instance.
Prevent → Keep metric definitions in one module; use a fresh registry in tests.
More on Concurrency, async, tests, services & containers
`RuntimeError: asyncio.run() cannot be called from a running event loop` in a Jupyter notebook or inside an async framework.Intermediate`RuntimeWarning: coroutine 'fetch' was never awaited` and nothing happens.BeginnerAn asyncio health-checker is no faster than a sequential loop.Advanced`Task was destroyed but it is pending!` at shutdown.Advanced`OSError: [Errno 24] Too many open files` from an asyncio scanner with 20,000 targets.IntermediateA `ThreadPoolExecutor` job finishes "successfully" but half the work is missing, with no errors logged.Intermediate