GET /api/v0/biomodel/{id}/biomodel.bngl returns 500 for any BioModel with zero applications
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
Direzione di ricerca
Inizia da vcell-api/src/main/java/org/vcell/rest/server/BiomodelBNGLServerResource.java intorno alla riga 118, dove viene chiamato getSimulationContext(0) dopo XmlHelper.XMLToBioModel; verifica cosa restituisce il metodo per zero contesti di simulazione e come il catch (Exception e) finale mappa i fallimenti su 500. Aggiungi un guard che restituisca un errore client (400/404) che indichi che il BioModel non ha applicazioni, prima di qualsiasi accesso tramite indice, e conferma con una richiesta verso biomodel 321238605 che in precedenza restituiva 500. Si è conclusi quando i modelli senza applicazioni producono l'errore client scelto, mentre i modelli con applicazioni continuano a esportare BNGL invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
GET /api/v0/biomodel/{id}/biomodel.bngl returns HTTP 500 with Index 0 out of bounds for length 0
for any BioModel that has zero applications. A model with no application is perfectly legal,
so this is a routine input reaching an unguarded array access and surfacing as a server error.
Reproduce
$ curl -s -o /dev/null -w '%{http_code}\n' \
'https://vcell.cam.uchc.edu/api/v0/biomodel/321238605/biomodel.bngl'
500
$ curl -s 'https://vcell.cam.uchc.edu/api/v0/biomodel/321238605/biomodel.bngl'
status = (Index 0 out of bounds for length 0),
request = (GET http://vcell.cam.uchc.edu/api/v0/biomodel/321238605/biomodel.bngl HTTP/1.1),
response = (HTTP/1.1 - Internal Server Error (500) - Index 0 out of bounds for length 0)
Deterministic, not load-related. BioModel 321238605 (kartik-bm-new, public) reports
"applications": [].
Cause
BiomodelBNGLServerResource.java:118:
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(biomodelVCML));
SimulationContext chosenSimContext = bioModel.getSimulationContext(0); // <-- throws when there are none
RbmNetworkGenerator.writeBngl(chosenSimContext, pw, false, true);
With no simulation contexts, getSimulationContext(0) throws
ArrayIndexOutOfBoundsException, which the catch-all at the end of the method converts to
Status.SERVER_ERROR_INTERNAL.
Scope
The correlation is exact across a sample of six public models:
| bmKey | applications | biomodel.bngl |
|---|---|---|
| 321238605 | 0 | 500 |
| 320046667 | 1 | 200 |
| 320029568 | 1 | 200 |
| 316581880 | 4 | 200 |
| 315396932 | 1 | 200 |
| 315272981 | 1 | 200 |
It is not a rare shape: in the single listing GET /api/v0/biomodel?category=educational&maxRows=1000,
63 of 1000 models have zero applications, so every one of those 500s on this endpoint.
Suggested fix
Guard the empty case and return a client error that says what is wrong, rather than a 500 — e.g.
404 or 400 with "BioModel has no application; a BNGL export requires one". Two further points
worth deciding while in there:
- Silently picking index 0 is itself questionable for a model with several applications
(316581880has 4). The caller has no way to choose, and no way to know which was exported. - The
catch (Exception e)at the bottom maps every unexpected failure to a 500 carrying the raw
exception message, which is how anArrayIndexOutOfBoundsExceptionended up as user-facing API
output.
How this surfaced
Found in the vcell-ai-rke-dev namespace, where the AI backend's vcelldb_service proxies to this
endpoint and logged four consecutive failures:
ERROR | vcelldb_service | HTTP error fetching BNGL file for biomodel 321238605:
500 - status = (Index 0 out of bounds for length 0)
- Lingua principale
- Java
- Stelle
- 140
- Fork
- 35
- Merge medio
- 17h 39m
- PR unite (30g)
- 19
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di virtualcell/vcell
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
virtualcell/vcell#2193 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Accessibility Requirement Java-based User Interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
virtualcell/vcell#2138 ·
I maintainer di solito rispondono entro 1 giorno
-
Accessibility Requirement Java-based
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
virtualcell/vcell#2137 ·
I maintainer di solito rispondono entro 1 giorno
-
Accessibility Requirement User Interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
virtualcell/vcell#2135 ·
I maintainer di solito rispondono entro 1 giorno
-
Accessibility Requirement Java-based User Interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
virtualcell/vcell#2134 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di virtualcell/vcell
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
wpilibsuite/SystemcoreTesting#446 ·
I maintainer di solito rispondono entro 1 giorno
-
frontend quality-assurance
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#212 ·
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Docs: AGENTS.md agent/ module-map bullet missing AgentWriteRules — the deny-by-default write gateApertadocumentation hermes-queue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
chrisalunlloyd2-sudo/mindpalace#334 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 2 giorni