Skip to content

πŸ› [BUG] Startup failure on app created with warehouse resourceΒ #124

@maucaro

Description

@maucaro

Created an app with with a warehouse resource (apx init)

Tried to run the app (apx dev start)

Output:
πŸ›« Preflight check started...
βœ“ verified project layout (0ms)
βœ“ uv sync (17ms)
βœ“ version file (619ms)
βœ“ node_modules (cached)
βœ… Ready for takeoff! (1s 385ms)

πŸš€ Starting dev server...
⏳ Waiting for dev server to become healthy...

2026-02-24 08:21:02.826 | db | out | Resolving dependencies
2026-02-24 08:21:03.241 | db | out | Resolved, downloaded and extracted [2]
2026-02-24 08:21:03.277 | db | out | Saved lockfile
2026-02-24 08:21:03.533 | db | out | Initializing PGLite with database: memory://
2026-02-24 08:21:03.534 | db | out | Debug level: 0
2026-02-24 08:21:04.105 | db | out | PGlite database initialized
2026-02-24 08:21:04.108 | db | out | PGLiteSocketServer listening on {"port":4908,"host":"0.0.0.0"}
2026-02-24 08:21:04.132 | db | out | Client connected from 127.0.0.1:58569
2026-02-24 08:21:04.696 | app | out | INFO / uvicorn.error / Will watch for changes in these directories: ['/Users/mauricio.caro/Code/apx-apps/hw1']
2026-02-24 08:21:04.696 | app | out | INFO / uvicorn.error / Uvicorn running on http://0.0.0.0:8050 (Press CTRL+C to quit)
2026-02-24 08:21:04.697 | app | out | INFO / uvicorn.error / Started reloader process [44829] using StatReload
2026-02-24 08:21:04.536 | ui | out | Starting frontend dev server...
2026-02-24 08:21:04.536 | ui | out | Config: port=5177, devServerPort=9001, devServerHost=0.0.0.0, frontendHost=127.0.0.1
2026-02-24 08:21:04.539 | ui | out | Creating vite server...
2026-02-24 08:21:04.640 | ui | out | Starting to listen...
2026-02-24 08:21:04.649 | ui | out | [READY] Frontend server listening on port 5177
2026-02-24 08:21:04.743 | ui | out | Redirecting to: http://127.0.0.1:9001/
2026-02-24 08:21:05.395 | app | out | INFO / uvicorn.error / Started server process [44842]
2026-02-24 08:21:05.395 | app | out | INFO / uvicorn.error / Waiting for application startup.
2026-02-24 08:21:05.396 | app | out | INFO / fast-wolf / Starting app with configuration:
2026-02-24 08:21:05.396 | app | out | app_name='fast-wolf'
2026-02-24 08:21:05.396 | app | out | INFO / databricks.sdk / loading DEFAULT profile from ~/.databrickscfg: host, auth_type
2026-02-24 08:21:05.414 | app | out | INFO / databricks.sdk / Using Databricks CLI authentication
2026-02-24 08:21:05.417 | app | err | ERROR / uvicorn.error / Traceback (most recent call last):
2026-02-24 08:21:05.417 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/.venv/lib/python3.11/site-packages/starlette/routing.py", line 694, in lifespan
2026-02-24 08:21:05.418 | app | out | async with self.lifespan_context(app) as maybe_state:
2026-02-24 08:21:05.418 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.419 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.419 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.419 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 201, in merged_lifespan
2026-02-24 08:21:05.419 | app | out | async with original_context(app) as maybe_original_state:
2026-02-24 08:21:05.420 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.420 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.420 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.420 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/src/fast_wolf/backend/core/_factory.py", line 62, in _composed_lifespan
2026-02-24 08:21:05.421 | app | out | async with _chain_dep_lifespans(all_deps, app):
2026-02-24 08:21:05.421 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.421 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.421 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.421 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/src/fast_wolf/backend/core/_factory.py", line 29, in _chain_dep_lifespans
2026-02-24 08:21:05.422 | app | out | async with _chain_dep_lifespans(tail, app):
2026-02-24 08:21:05.422 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.422 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.423 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.423 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/src/fast_wolf/backend/core/_factory.py", line 29, in _chain_dep_lifespans
2026-02-24 08:21:05.423 | app | out | async with _chain_dep_lifespans(tail, app):
2026-02-24 08:21:05.423 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.423 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.424 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.424 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/src/fast_wolf/backend/core/_factory.py", line 28, in _chain_dep_lifespans
2026-02-24 08:21:05.424 | app | out | async with head.lifespan(app):
2026-02-24 08:21:05.424 | app | out | File "/Users/mauricio.caro/.pyenv/versions/3.11.10/lib/python3.11/contextlib.py", line 210, in aenter
2026-02-24 08:21:05.424 | app | out | return await anext(self.gen)
2026-02-24 08:21:05.425 | app | out | ^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.425 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/src/fast_wolf/backend/core/sql.py", line 46, in lifespan
2026-02-24 08:21:05.425 | app | out | app.state.sql_config = SqlConfig() # ty: ignore[missing-argument]
2026-02-24 08:21:05.425 | app | out | ^^^^^^^^^^^
2026-02-24 08:21:05.425 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/.venv/lib/python3.11/site-packages/pydantic_settings/main.py", line 242, in init
2026-02-24 08:21:05.426 | app | out | super().init(**pydantic_self.class._settings_build_values(sources, init_kwargs))
2026-02-24 08:21:05.426 | app | out | File "/Users/mauricio.caro/Code/apx-apps/hw1/.venv/lib/python3.11/site-packages/pydantic/main.py", line 250, in init
2026-02-24 08:21:05.426 | app | out | validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
2026-02-24 08:21:05.427 | app | out | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-02-24 08:21:05.427 | app | out | pydantic_core._pydantic_core.ValidationError: 1 validation error for SqlConfig
2026-02-24 08:21:05.427 | app | out | warehouse_id
2026-02-24 08:21:05.427 | app | out | Field required [type=missing, input_value={}, input_type=dict]
2026-02-24 08:21:05.427 | app | out | For further information visit https://errors.pydantic.dev/2.12/v/missing
2026-02-24 08:21:05.428 | app | out |
2026-02-24 08:21:05.428 | app | err | ERROR / uvicorn.error / Application startup failed. Exiting.
2026-02-24 08:21:05.948 | ui | out | Redirecting to: http://127.0.0.1:9001/

Cursor diagnosed and fixed the error and summarized it:
The app now starts successfully.
Root cause: The app failed during startup because SqlConfig required warehouse_id, which is loaded from DATABRICKS_SQL_WAREHOUSE_ID. That variable was not set in .env, so Pydantic raised a validation error.
Changes made:
src/fast_wolf/backend/core/sql.py – warehouse_id now has a default of "", so the app can start without the env var. If a route uses Dependencies.Sql without a configured warehouse, it will return a 503 with a clear message.
.env – Added a commented example for DATABRICKS_SQL_WAREHOUSE_ID and instructions on how to obtain it.
To enable SQL features: Uncomment and set DATABRICKS_SQL_WAREHOUSE_ID in .env with your SQL warehouse ID (from Databricks: SQL Warehouses β†’ select warehouse β†’ copy ID from the URL).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions