Symptom
A locally-hosted TaxServer (the sendsketch.sh server) returns HTTP 400 for every query when the sketch uses a single k-mer length (e.g. a custom k=31 sketch DB):
<h1>400 Bad Request</h1>NumberFormatException thrown
With assertions enabled (-ea) the server thread instead crashes silently. This makes it impossible to run a local sketch server (GTDB, RefSeq, custom genomes, etc.) built with a single k.
Queries against JGI's public servers are unaffected, because those use the default dual-k (k=32,24), which takes a different parse branch.
Root cause
current/sketch/SketchTool.java, method loadSketchesFromString() (the path that parses the sketch a client POSTs). The single-value branch of the K: header parser passes the full field string s ("K:31") to Integer.parseInt instead of the value substring sub ("31"):
}else if(s.startsWith("K:")){//Kmer length
if(sub.indexOf(',')>=0){ // dual-k: "K:32,24" -> OK
...
}else{
k_sketch=Integer.parseInt(s); // single-k: "K:31" -> NumberFormatException
k2_sketch=0;
}
}
The comma branch and every other field parser in the same block (H:, BC:, GS:, GK:, …) already use sub; only this single-k branch uses s. The two file-reading parsers (loadSketchesFromSketchFile/...File2) are correct — only loadSketchesFromString is affected.
Reproduction (current master, v39.91)
| query sketch |
result |
single k=31 (K:31) |
HTTP 400 / NumberFormatException |
default dual-k (K:32,24) |
works |
sketch.sh in=ref.fa out=db_k31.sketch k=31 mode=sequence
taxserver.sh tree=tree.taxtree.gz port=3068 k=31 index db_k31.sketch
sendsketch.sh in=query.fa address=http://localhost:3068/sketch k=31 → 400
Also present in 39.52.
Fix / workaround
One-line fix submitted as #22:
- k_sketch=Integer.parseInt(s);
+ k_sketch=Integer.parseInt(sub);
Until that's released, anyone hitting this can patch current/sketch/SketchTool.java in their install (the single-k branch in loadSketchesFromString), recompile that one class against their bbtools.jar, and restart the server — or build their sketches with the default k=32,24 instead of a single k.
🤖 Generated with Claude Code — model: Claude Opus 4.8 (1M context) (claude-opus-4-8[1m])
Symptom
A locally-hosted
TaxServer(thesendsketch.shserver) returns HTTP 400 for every query when the sketch uses a single k-mer length (e.g. a customk=31sketch DB):With assertions enabled (
-ea) the server thread instead crashes silently. This makes it impossible to run a local sketch server (GTDB, RefSeq, custom genomes, etc.) built with a singlek.Queries against JGI's public servers are unaffected, because those use the default dual-k (
k=32,24), which takes a different parse branch.Root cause
current/sketch/SketchTool.java, methodloadSketchesFromString()(the path that parses the sketch a client POSTs). The single-value branch of theK:header parser passes the full field strings("K:31") toInteger.parseIntinstead of the value substringsub("31"):The comma branch and every other field parser in the same block (
H:,BC:,GS:,GK:, …) already usesub; only this single-k branch usess. The two file-reading parsers (loadSketchesFromSketchFile/...File2) are correct — onlyloadSketchesFromStringis affected.Reproduction (current
master, v39.91)k=31(K:31)K:32,24)sketch.sh in=ref.fa out=db_k31.sketch k=31 mode=sequencetaxserver.sh tree=tree.taxtree.gz port=3068 k=31 index db_k31.sketchsendsketch.sh in=query.fa address=http://localhost:3068/sketch k=31→ 400Also present in 39.52.
Fix / workaround
One-line fix submitted as #22:
Until that's released, anyone hitting this can patch
current/sketch/SketchTool.javain their install (the single-k branch inloadSketchesFromString), recompile that one class against theirbbtools.jar, and restart the server — or build their sketches with the defaultk=32,24instead of a singlek.🤖 Generated with Claude Code — model: Claude Opus 4.8 (1M context) (
claude-opus-4-8[1m])