ea82eeb86ad5cf92ddf795f2d6f9ce84e33e52d5
chmalee
  Wed Jul 29 11:20:16 2026 -0700
Stop hubApi /search from crashing on position matches and curated hub genomes. refs #37956

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/hg/cgilib/cartJson.c src/hg/cgilib/cartJson.c
index 51ad8ea526a..fcc76e374af 100644
--- src/hg/cgilib/cartJson.c
+++ src/hg/cgilib/cartJson.c
@@ -67,34 +67,37 @@
 return textIn;
 }
 
 void hgPositionsJson(struct jsonWrite *jw, char *db, struct hgPositions *hgp, struct cart *cart)
 /* Write out JSON description of multiple position matches. */
 {
 struct hgPosTable *table;
 jsonWriteListStart(jw, "positionMatches");
 struct trackDb *tdbList = NULL;
 for (table = hgp->tableList; table != NULL; table = table->next)
     {
     if (table->posList != NULL)
         {
         char *trackName = table->name, *tableName = table->name;
         struct trackDb *tdb = NULL;
-        // clear the tdb cache if this track is a hub track
+        // these are pseudo-table names with no trackDb entry to look up. chromInfo is what
+        // hgFind uses for a plain position range or a genomic HGVS match
         if (! (sameString("trackDb", tableName) || sameString("helpDocs", tableName) ||
-                sameString("publicHubs", tableName)))
+                sameString("publicHubs", tableName) || sameString("chromInfo", tableName)))
             {
+            // a native tdbList carried over from an earlier table won't hold hub tracks,
+            // drop it so tdbForTrack takes its hub lookup path
             if (isHubTrack(tableName))
                 tdbList = NULL;
             tdb = tdbForTrack(db, tableName, &tdbList);
             if (!tdb && startsWith("all_", tableName))
                 tdb = tdbForTrack(db, tableName+strlen("all_"), &tdbList);
             if (!tdb && startsWith("xeno", tableName))
                 {
                 // due to genbank track changes over the years, sometimes tables
                 // get left on different servers when their trackDb entry was removed
                 // long ago. In that case skip those hits
                 continue;
                 }
             if (!tdb)
                 errAbort("no track for table \"%s\" found via a findSpec", tableName);
             trackName = tdb->track;