Summary
When a value set's compose.include carries a valueset-supplement extension (valueString/valueUri) naming a supplement the server does not have, $expand/$validate-code crash with HTTP 500 and a JavaScript TypeError instead of returning a structured error about the unknown supplement.
Repro (live)
curl -sS -X POST 'https://tx.fhir.org/r4/ValueSet/$expand' \
-H 'Content-Type: application/fhir+json' -w '\nHTTP %{http_code}\n' -d '{
"resourceType":"Parameters","parameter":[{"name":"valueSet","resource":{
"resourceType":"ValueSet","status":"active","compose":{"include":[{
"system":"http://hl7.org/fhir/administrative-gender",
"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/valueset-supplement",
"valueUri":"http://example.org/no-such-supplement"}]}]}}}]}'
Observed
HTTP 500
{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"exception","details":{"text":"TerminologyError is not a constructor"},"diagnostics":"TerminologyError is not a constructor"}]}
Likely cause
tx/workers/worker.js:1 does const { TerminologyError } = require('../operation-context'), but operation-context.js does not export TerminologyError (it is exported from tx/library/errors.js). So at worker.js:321 — the checkSupplements "ValueSet depends on supplement '…' that is not known" path — TerminologyError is undefined and new TerminologyError(...) throws is not a constructor, masking the intended clean error. (Controls: with no supplement extension → 200; with the value as valueCanonical instead of valueUri/valueString → 200, because worker.js:319 only reads valueString||valueUri.)
Expected
A structured OperationOutcome reporting the unknown supplement (the intent of the throw), not an uncaught TypeError. (Per http.html, a failure "SHOULD be accompanied by an OperationOutcome"; per operationoutcome.html the issue should state the real reason.) Related: #104 (unknown useSupplement handling).
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
When a value set's
compose.includecarries avalueset-supplementextension (valueString/valueUri) naming a supplement the server does not have,$expand/$validate-codecrash with HTTP 500 and a JavaScriptTypeErrorinstead of returning a structured error about the unknown supplement.Repro (live)
Observed
Likely cause
tx/workers/worker.js:1doesconst { TerminologyError } = require('../operation-context'), butoperation-context.jsdoes not exportTerminologyError(it is exported fromtx/library/errors.js). So atworker.js:321— thecheckSupplements"ValueSet depends on supplement '…' that is not known" path —TerminologyErrorisundefinedandnew TerminologyError(...)throwsis not a constructor, masking the intended clean error. (Controls: with no supplement extension → 200; with the value asvalueCanonicalinstead ofvalueUri/valueString→ 200, becauseworker.js:319only readsvalueString||valueUri.)Expected
A structured
OperationOutcomereporting the unknown supplement (the intent of the throw), not an uncaughtTypeError. (Per http.html, a failure "SHOULD be accompanied by an OperationOutcome"; per operationoutcome.html the issue should state the real reason.) Related: #104 (unknownuseSupplementhandling).Confirmed live against
https://tx.fhir.orgon 2026-06-06 (softwareFHIRsmith 0.9.6). Source line refs are from the publishedmainbranch.