Summary
POSTing any Bundle to a non-R5 endpoint (/r4, /r3, /r4b) returns HTTP 500 with a raw HTML stack-trace page (not an OperationOutcome). The R4/R3→R5 Bundle converter throws unconditionally.
Repro (live)
curl -sS -X POST 'https://tx.fhir.org/r4/' \
-H 'Content-Type: application/fhir+json' -w '\nHTTP %{http_code} | %{content_type}\n' \
-d '{"resourceType":"Bundle","type":"batch","entry":[]}'
# => HTTP 500, text/html, <!DOCTYPE html> … stack trace through tx/tx.js:393
Likely cause
tx/xversion/xv-bundle.js bundleToR5(): after the R5 early-return it loops the entries and then runs an unconditional throw new Error('Unsupported FHIR version: …') (so the line is reached for every non-R5 Bundle; it should be return jsonObj, mirroring the R5 early-return and bundleFromR5). It is invoked from the inbound body-conversion middleware (tx/tx.js ~:469, convertResourceToR5(req.body, …)) before routing and with no try/catch, so any Bundle body on a non-R5 endpoint 500s regardless of the target operation.
Expected
The Bundle should be processed (or rejected with a clean 4xx OperationOutcome) — not an uncaught throw rendered as an HTML 500. (Per http.html, errors at a FHIR-aware level SHOULD be an OperationOutcome; cf. #100 for the HTML-instead-of-OperationOutcome theme.)
Confirmed live against https://tx.fhir.org on 2026-06-06 (software FHIRsmith 0.9.6). Source line refs are from the published main branch.
Summary
POSTing any Bundle to a non-R5 endpoint (
/r4,/r3,/r4b) returns HTTP 500 with a raw HTML stack-trace page (not anOperationOutcome). The R4/R3→R5 Bundle converter throws unconditionally.Repro (live)
Likely cause
tx/xversion/xv-bundle.jsbundleToR5(): after the R5 early-return it loops the entries and then runs an unconditionalthrow new Error('Unsupported FHIR version: …')(so the line is reached for every non-R5 Bundle; it should bereturn jsonObj, mirroring the R5 early-return andbundleFromR5). It is invoked from the inbound body-conversion middleware (tx/tx.js~:469,convertResourceToR5(req.body, …)) before routing and with no try/catch, so any Bundle body on a non-R5 endpoint 500s regardless of the target operation.Expected
The Bundle should be processed (or rejected with a clean 4xx
OperationOutcome) — not an uncaught throw rendered as an HTML 500. (Per http.html, errors at a FHIR-aware level SHOULD be anOperationOutcome; cf. #100 for the HTML-instead-of-OperationOutcome theme.)Confirmed live against
https://tx.fhir.orgon 2026-06-06 (softwareFHIRsmith 0.9.6). Source line refs are from the publishedmainbranch.