Denys Y
09/08/2025, 9:26 AMMarvin
09/08/2025, 9:26 AMDenys Y
09/08/2025, 9:26 AMFile "/usr/local/lib/python3.12/site-packages/asyncpg/prepared_stmt.py", line 256, in __do_execute
return await executor(protocol)
^^^^^^^^^^^^^^^^^^^^^^^^
File "asyncpg/protocol/protocol.pyx", line 206, in bind_execute
TimeoutError
09:23:58.077 | ERROR | prefect.server - Error running before-transition hook in rule <class 'prefect.server.orchestration.core_policy.SecureFlowConcurrencySlots'>: !TimeoutError()
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/prefect/server/orchestration/rules.py", line 651, in __aenter__
await self.before_transition(*entry_context)
File "/usr/local/lib/python3.12/site-packages/prefect/server/orchestration/core_policy.py", line 427, in before_transition
acquired = await concurrency_limits_v2.bulk_increment_active_slots(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/server/models/concurrency_limits_v2.py", line 208, in bulk_increment_active_slots
result = await session.execute(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/session.py", line 463, in execute
result = await greenlet_spawn(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn
result = context.switch(value)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2365, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2251, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1660, in orm_execute_statement
return super().orm_execute_statement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement
result = conn.execute(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2358, in _handle_dbapi_exception
raise exc_info[1].with_traceback(exc_info[2])
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 580, in execute
self._adapt_connection.await_(
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 558, in _prepare_and_execute
self._handle_exception(error)
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 508, in _handle_exception
self._adapt_connection._handle_exception(error)
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 794, in _handle_exception
raise error
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 545, in _prepare_and_execute
self._rows = deque(await prepared_stmt.fetch(*parameters))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/asyncpg/prepared_stmt.py", line 176, in fetch
data = await self.__bind_execute(args, 0, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/asyncpg/prepared_stmt.py", line 267, in __bind_execute
data, status, _ = await self.__do_execute(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/asyncpg/prepared_stmt.py", line 256, in __do_execute
return await executor(protocol)
^^^^^^^^^^^^^^^^^^^^^^^^
File "asyncpg/protocol/protocol.pyx", line 206, in bind_execute
TimeoutError
09:23:58.098 | ERROR | prefect - Error releasing concurrency slots on cleanup: Can't reconnect until invalid transaction is rolled back. Please rollback() fully before proceeding (Background on this error at: <https://sqlalche.me/e/20/8s2b>)
09:23:58.109 | ERROR | prefect.server - Encountered exception in request:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
await <http://self.app|self.app>(scope, receive, _send)
Marvin
09/08/2025, 9:31 AMprefect version
prefect config view
Please share the values for PREFECT_API_URL
and any PREFECT_SERVER_*
you’ve set.
- Start the server with debug logs (and optionally without services/UI to isolate issues)
prefect server start --log-level DEBUG
# Optional isolations:
# prefect server start --no-services
# prefect server start --no-ui
- Health checks
- Connectivity: hit the hello endpoint (replace with your API URL)
curl -sSf ${PREFECT_API_URL%/}/api/hello
- Readiness/health endpoints are documented here: Health-check endpoints
Common issues and fixes
1) Database migrations or schema errors
- Upgrade DB:
prefect server database upgrade -y
- If you’re stuck in a bad migration and can afford to wipe local data (destructive):
prefect server database reset -y
- If using Postgres, ensure PREFECT_SERVER_DATABASE_CONNECTION_URL
is set correctly (see settings ref below).
2) Port already in use / binding errors
- Change the port or stop the conflicting process:
prefect server start --port 4201
3) SQLite “database is locked”
- Stop any other server instance or background process using the same DB.
- Consider Postgres for concurrency and stability.
4) CORS/UI not loading or API blocked
- If you see CORS errors in the browser, configure CORS-related server settings (e.g., allowed origins/headers) and ensure your reverse proxy forwards the right headers and websockets.
- Double-check that the UI is pointing at the correct API (PREFECT_API_URL
) and that it’s reachable from the browser.
5) Reverse proxy / SSL
- Terminate TLS at your proxy and forward X-Forwarded-*
headers.
- Ensure the external PREFECT_UI_URL
and PREFECT_API_URL
match what users/clients access.
- Verify websockets pass through your proxy.
6) Services not running (scheduler, late-run handling)
- List and start services if you disabled `--no-services`:
prefect server services ls
prefect server services start
Useful docs
- Prefect Server overview
- Settings reference (PREFECT_* env vars)
- Health-check endpoints
If you paste:
- The exact error text
- How you start the server (command + flags)
- Your DB (SQLite or Postgres) and any relevant `PREFECT_SERVER_*`/`PREFECT_API_*` settings
- Whether you’re behind a reverse proxy
…I can pinpoint the fix quickly.