Skip to content

HTML rendering (_format=html) of expansions crashes with HTTP 500 in several renderer methods #244

@jmandel

Description

@jmandel

Summary

Requesting the human-readable HTML view (_format=html / Accept: text/html) of an otherwise-valid $expand crashes with HTTP 500 (uncaught errors in tx/library/renderer.js). At least two distinct triggers, plus a couple more wrong-key derefs in the same file.

Honest scope: HTML rendering is not a normatively-required FHIR representation, so this is a robustness/quality issue rather than a spec-conformance violation. Filed because a valid operation shouldn't 500 just because the HTML view was requested. Same class as the (closed) #175 renderer crash.

Repro A (live) — meta.version set → this.displayDate is not a function

curl -sS -X POST 'https://tx.fhir.org/r4/ValueSet/$expand?_format=html' \
  -H 'Content-Type: application/fhir+json' -w '\nHTTP %{http_code}\n' -d '{
  "resourceType":"Parameters","parameter":[{"name":"valueSet","resource":{
    "resourceType":"ValueSet","url":"http://example.org/f50","status":"active",
    "meta":{"version":"MV-XYZ"},
    "compose":{"include":[{"system":"http://hl7.org/fhir/account-status"}]}}},{"name":"count","valueInteger":1}]}'
# => HTTP 500 (Internal Server Error)

renderMetadataLastUpdated (entered from renderMetadataTable when meta.version is set) calls this.displayDate(...), which is not a method.

Repro B (live) — valueset-supplement extension → renderCompose passes the Extension object as a uri

curl -sS -X POST 'https://tx.fhir.org/r4/ValueSet/$expand?_format=html' \
  -H 'Content-Type: application/fhir+json' -w '\nHTTP %{http_code}\n' -d '{
  "resourceType":"Parameters","parameter":[{"name":"valueSet","resource":{
    "resourceType":"ValueSet","url":"http://example.org/f54","status":"active",
    "extension":[{"url":"http://hl7.org/fhir/StructureDefinition/valueset-supplement",
                  "valueCanonical":"http://hl7.org/fhir/CodeSystem/example-supplement"}],
    "compose":{"include":[{"system":"http://hl7.org/fhir/CodeSystem/example"}]}}},
    {"name":"includeDefinition","valueBoolean":true},{"name":"count","valueInteger":2}]}'
# => HTTP 500 (Internal Server Error)

The renderCompose supplements loop passes the whole valueset-supplement Extension object to renderLinkComma as the uri (it should pass getValuePrimitive(ext)), so resolveURL does system.includes('|') on an object → throw.

Also in renderer.js (same class, likely same surface)

  • renderMetadataLabels calls this.renderCodin(...) (typo for renderCoding) when meta.label.length > 1.
  • renderCoding / renderLinkComma destructure {desc, url} from resolveCode/resolveURL, which return {link, description} (and resolveURL is async) — wrong keys + a null destructure when no linkResolver.

Expected

The HTML view renders (or degrades gracefully); a valid $expand should not 500 because HTML was requested.


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions