cc5381e539ecba5b07109b194acf1d76b0c8f641
braney
  Thu Jul 23 06:22:48 2026 -0700
Guard hDbForTaxon() callers against curated hub (GenArk) db names. hDbForTaxon() can now return a GenArk-only assembly with no real SQL database, which would abort in sqlConnect()/"use <db>"/cross-db sqlTableExists(). Treat a hubConnectIsCurated() db as no usable native db in uniProtAccToDb(), bacProbeInfo(), and getKnownGeneUrl(). refs #37909

diff --git src/hg/hgLinkIn/handlerList.c src/hg/hgLinkIn/handlerList.c
index 2e5901a628d..3911b4b98da 100644
--- src/hg/hgLinkIn/handlerList.c
+++ src/hg/hgLinkIn/handlerList.c
@@ -1,24 +1,25 @@
 /* Copyright (C) 2017 The Regents of the University of California
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 /* handlerList - a list of handler functions for translating identifiers
  * from different external databases to browser positions.  Used by
  * linkInHandlers.c. */
 
 #include "common.h"
 #include "hdb.h"
+#include "hubConnect.h"
 #include "jksql.h"
 #include "handlerList.h"
 
 /********************************************
  *      UniProtKB Handler
  *******************************************/
 
 /* Databases whose IDs we can link to using the position parameter.  ... this varies by database,
  * so be restrictive.  Ordered by preference. */
 /* 1 = EMBL, 2 = RefSeq, */
 #define UniProtExtRefSeqId 2
 #define UniProtExtEMBLId 1
 
 /*
  * +---------+--------------+----+-----+------+--+
@@ -51,30 +52,35 @@
 }
 
 
 char *uniProtAccToDb(char *id, struct sqlConnection *conn)
 /* Searches the uniProt database (which conn must be connected to)
  * for the given identifier and returns the name of the database
  * that is most relevant.  This is usually the default assembly
  * for the genome that the identifier is on. */
 {
 char *db = NULL;
 char query[4096];
 sqlSafef(query, sizeof(query), "select taxon from accToTaxon where acc = '%s'", id);
 int taxon = sqlQuickNum(conn, query);
 if (taxon != 0)
     db = hDbForTaxon(taxon);
+/* hDbForTaxon may return a curated hub (GenArk) assembly with no real SQL
+ * database.  This handler issues "use <db>" and queries native tables, so a
+ * hub db name would abort.  Treat it as no usable native db. */
+if (db != NULL && hubConnectIsCurated(db))
+    db = NULL;
 return db;
 }
 
 
 struct linkInResult *getEmblList(char *db, struct slName *emblNames, struct sqlConnection *conn)
 /* Given a connection to a genome database (e.g., hg19), the name of that database, and
  * a list of identifiers, search for any EMBL mRNA names that we have positions for.
  * Return a list of matching positions. */
 {
 struct linkInResult *results = NULL;
 bool hasMRna = sqlTableExists(conn, "all_mrna");
 if (!hasMRna)
     return NULL;
 struct dyString *query = dyStringNew(0);
 sqlDyStringPrintf(query, "select tName, tStart, tEnd from all_mrna where qName in (");