3b070db77a829321ba062367c4860adb671ab743
braney
  Fri Oct 25 16:50:55 2024 -0700
put out a better error message if a hub-based assembly disappears.  Refs #34611

diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index fd69cb9..c92bc58 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -4190,30 +4190,43 @@
 return tdbList;
 }
 
 struct trackDb *hTrackDbWithCartVersion(char *db, int *retCartVersion)
 /* Load tracks associated with current db.
  * Supertracks are loaded as a trackDb, but are not in the returned list,
  * but are accessible via the parent pointers of the member tracks.  Also,
  * the supertrack trackDb subtrack fields are not set here (would be
  * incompatible with the returned list)
  * Returns list sorted by priority
  *	NOTE: this result is cached, do not free it !
  */
 {
 if (trackHubDatabase(db))
     return NULL;
+
+if (isHubTrack(db))
+    {
+    // this means the db has a hub_#_ prefix but didn't get loaded at init time
+    unsigned hubId = hubIdFromTrackName(db);
+    struct hubConnectStatus *status = hubFromIdNoAbort(hubId);
+
+    if (status->errorMessage)
+        errAbort("Cannot set database to %s.  Hub %s is reporting error: %s\n", hubConnectSkipHubPrefix(db), status->hubUrl, status->errorMessage);
+    else
+        errAbort("Cannot find genome %s in %s\n", hubConnectSkipHubPrefix(db), status->hubUrl);
+    }
+
 struct trackDb *tdbList = NULL;
 
 boolean doCache = trackDbCacheOn();
 char *tdbPathString = hTrackDbPath();
 
 if (doCache)
     {
     struct slName *tableList = hTrackDbList();
 
     struct sqlConnection *conn = hAllocConn(db);
     time_t newestTime = 0;
     for(; tableList; tableList = tableList->next)
         {
         time_t tableTime = sqlTableUpdateTime(conn, tableList->name);
         newestTime = tableTime > newestTime ? tableTime : newestTime;