11import { getHealth , postApiV1BetaSecrets } from '@api/sdk.gen'
2+ import { client } from '@api/client.gen'
23import { Main } from '@/common/components/layout/main'
34import { TopNav } from '@/common/components/layout/top-nav'
45import { Error as ErrorComponent } from '@/common/components/error'
@@ -19,6 +20,7 @@ import '@fontsource/atkinson-hyperlegible/400-italic.css'
1920import '@fontsource/atkinson-hyperlegible/700-italic.css'
2021import '@fontsource-variable/inter/wght.css'
2122import log from 'electron-log/renderer'
23+ import * as Sentry from '@sentry/electron/renderer'
2224
2325async function setupSecretProvider ( queryClient : QueryClient ) {
2426 const createEncryptedProvider = async ( ) =>
@@ -112,7 +114,43 @@ export const Route = createRootRouteWithContext<{
112114 gcTime : 0 ,
113115 } )
114116 } catch ( error ) {
115- throw new Error ( `${ error } ` )
117+ const [ isToolhiveRunning , port , containerEngineStatus ] =
118+ await Promise . all ( [
119+ window . electronAPI . isToolhiveRunning ( ) ,
120+ window . electronAPI . getToolhivePort ( ) ,
121+ window . electronAPI . checkContainerEngine ( ) ,
122+ ] )
123+
124+ const clientConfig = client . getConfig ( )
125+
126+ log . error (
127+ `[beforeLoad] Client baseUrl: ${ clientConfig . baseUrl || 'NOT SET' } `
128+ )
129+ log . error ( `[beforeLoad] ToolHive process running: ${ isToolhiveRunning } ` )
130+
131+ Sentry . captureException ( error , {
132+ level : 'error' ,
133+ tags : {
134+ component : 'root-route' ,
135+ phase : 'beforeLoad' ,
136+ } ,
137+ extra : {
138+ toolhive_running : `${ isToolhiveRunning } ` ,
139+ toolhive_port : port ,
140+ client_base_url : clientConfig . baseUrl ,
141+ client_configured : `${ ! ! clientConfig . baseUrl } ` ,
142+ container_engine : {
143+ available : `${ containerEngineStatus . available } ` ,
144+ } ,
145+ error_message :
146+ error instanceof Error ? error . message : JSON . stringify ( error ) ,
147+ } ,
148+ fingerprint : [
149+ 'health-check-failed' ,
150+ isToolhiveRunning ? 'process-running' : 'process-not-running' ,
151+ ] ,
152+ } )
153+ throw new Error ( `Health check failed: ${ error } ` )
116154 }
117155 } ,
118156 loader : async ( { context : { queryClient } } ) =>
0 commit comments