Fix: Database initialization error preventing app launch in v0.3.0#191
Open
jordan-BAIC wants to merge 2 commits into
Open
Fix: Database initialization error preventing app launch in v0.3.0#191jordan-BAIC wants to merge 2 commits into
jordan-BAIC wants to merge 2 commits into
Conversation
…0.3.0 The app failed to launch after upgrading to v0.3.0 due to database migrations attempting to access a non-existent configManager instance via require(). Changes: - Pass configManager to DatabaseService constructor instead of using require() - Create serviceRegistry for managing singleton service instances - Update sessionValidation functions to optionally accept databaseService parameter - Remove problematic singleton database.ts that was never initialized - Update all references to use getDatabaseService() from registry This fixes the "Cannot read properties of undefined (reading 'getDefaultModel')" error that prevented the main window from appearing after app launch. Fixes #189 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the critical issue where Crystal fails to launch after upgrading to v0.3.0, with the main window not appearing despite the app starting.
Problem
Users reported that after updating to v0.3.0, the application would launch but the main window wouldn't appear. The root cause was a database migration failure with the error:
Root Cause
During database migrations, the code attempted to dynamically
require()a configManager instance that didn't exist. Theservices/configManagermodule only exported theConfigManagerclass, not an instance, causing the migration to fail and preventing the app from launching properly.Solution
services/database.tssingleton that was causing confusionTesting
Impact
This fix resolves the app launch failure that affected all users upgrading to v0.3.0.
Fixes #189
🤖 Generated with Claude Code