Skip to content

fix: show clear error when quickstart finds stale demo MySQL config#71

Merged
shirshanka merged 2 commits into
datahub-project:mainfrom
lakshay-nasa:fix/quickstart-stale-demo-error
Jun 3, 2026
Merged

fix: show clear error when quickstart finds stale demo MySQL config#71
shirshanka merged 2 commits into
datahub-project:mainfrom
lakshay-nasa:fix/quickstart-stale-demo-error

Conversation

@lakshay-nasa
Copy link
Copy Markdown
Collaborator

Summary

  • When a previous demo run left a MySQL DATABASE_URL in ~/.datahub/analytics-agent/.env, running quickstart would crash with a raw SQLAlchemy/pymysql traceback
  • Now detects the connection failure and shows a clear, actionable message telling the user to reset their config directory

Test plan

  • Run demo, then stop Docker, then run quickstart — verify the new error message appears
  • Run quickstart with no prior config — verify normal flow is unaffected

@lakshay-nasa lakshay-nasa force-pushed the fix/quickstart-stale-demo-error branch from 87bf0a7 to d6849fe Compare June 2, 2026 11:47
Detect the exact signature of the demo-written URL
(mysql+aiomysql://datahub:datahub@…/talkster) combined with a connection
failure in bootstrap stderr, automatically strip just DATABASE_URL from
.env, and retry. Bootstrap then falls through to the default SQLite DB and
the agent comes up cleanly — user keeps their LLM API keys, conversation
history, and any other config.

Falls back to printing stderr for any other failure (unchanged behaviour).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shirshanka
Copy link
Copy Markdown
Contributor

Thanks for the fix @lakshay-nasa — accurate diagnosis of the stale DATABASE_URL problem.

I pushed a follow-up commit (5d8feaf) that promotes the message from "tell the user to rm -rf" to self-healing: when we see the demo's exact DATABASE_URL signature plus a connection error, we strip only that one line from .env and re-run bootstrap. The agent then comes up on the default SQLite DB and the user keeps their LLM API keys, conversation history, and any other config.

Two small helpers (_is_stale_demo_db_failure, _strip_env_vars) + 10 unit tests covering Mac/Linux URLs, the false-positive cases (user-supplied MySQL, unrelated stderr), and .env line-stripping edge cases.

Let me know if anything looks off — happy to iterate.

@shirshanka shirshanka merged commit a3591f6 into datahub-project:main Jun 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants