05c7e605c01e595561c32690eb44a7512041e540 braney Wed Sep 23 09:34:08 2026 -0700 hubCheck: reject a bigBed type line that declares fewer than three fields, refs #36940 hgc already stops on "type bigBed 1" or "type bigBed 2", but hubCheck passed both, so a hub author only found out when a user clicked an item. Check the declared count against the minimum of three next to the existing check against the file's field count. A bare "type bigBed" does not reach this code and is unchanged. Adds a fieldCountTooFew test with bigBed 1 and bigBed 2 tracks. diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c index e3d2f0993f6..64f02b61594 100644 --- src/hg/lib/trackHub.c +++ src/hg/lib/trackHub.c @@ -1528,30 +1528,32 @@ else if (startsWithWord("bigNarrowPeak", type) || startsWithWord("bigBed", type) || startsWithWord("bigGenePred", type) || startsWithWord("bigPsl", type)|| startsWithWord("bigChain", type)|| startsWithWord("bigNet", type) || startsWithWord("bigMaf", type) || startsWithWord("bigBarChart", type) || startsWithWord("bigInteract", type) || startsWithWord("bigLolly", type) || startsWithWord("bigRmsk",type) || startsWithWord("bigMethyl", type)) { /* Just open and close to verify file exists and is correct type. */ struct bbiFile *bbi = bigBedFileOpen(bigDataUrl); char *typeString = cloneString(type); nextWord(&typeString); if (startsWithWord("bigBed", type) && (typeString != NULL)) { unsigned numFields = sqlUnsigned(nextWord(&typeString)); + if (numFields < 3) + errAbort("Track \"%s\" declares 'type bigBed %u', but a bigBed has at least 3 fields (chrom, chromStart, chromEnd). Change the type line to match the file's field count, or leave the number off and the count is read from the file.", trackHubSkipHubName(tdb->track), numFields); if (numFields > bbi->fieldCount) errAbort("bigBed file '%s' has %d fields, but track \"%s\" declares 'type bigBed %d'. Either regenerate the bigBed with the correct number of fields, or change the type line to match the file's field count.", bigDataUrl, bbi->fieldCount, trackHubSkipHubName(tdb->track), numFields); } bbiFileClose(&bbi); } else if (startsWithWord("vcfTabix", type) || startsWithWord("vcfPhasedTrio", type)) { /* Just open and close to verify file exists and is correct type. */ struct vcfFile *vcf = vcfTabixFileAndIndexMayOpen(bigDataUrl, bigDataIndex, NULL, 0, 0, 1, 1); if (vcf == NULL) // Warnings already indicated whether the tabix file is missing etc. errAbort("Couldn't open %s and/or its tabix index (.tbi) file for track %s. " "Both the .vcf.gz file and a matching .vcf.gz.tbi index must be publicly accessible " "at the same URL path. Generate the index with: tabix -p vcf yourFile.vcf.gz " "See https://genome.ucsc.edu/goldenPath/help/vcf.html",