HL7 / fhir-ig-publisher

Source code for the IG publisher
Apache License 2.0
69 stars 57 forks source link

Error generating IG when Extension with a value is added to composition sub-section #693

Open VictorShiller opened 1 year ago

VictorShiller commented 1 year ago

When adding an extension to a subsection of a composition an error or throws by _genonce.sh when its value is set. Generating Snapshots (01:14.645) Exception in thread "main" java.lang.StackOverflowError at org.hl7.fhir.r5.model.DataType.copyValues(DataType.java:72) at org.hl7.fhir.r5.model.BackboneType.copyValues(BackboneType.java:205) at org.hl7.fhir.r5.model.ElementDefinition.copyValues(ElementDefinition.java:12566) at org.hl7.fhir.r5.model.ElementDefinition.copy(ElementDefinition.java:12561) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processSimplePathWithEmptyDiffMatches(ProfilePathProcessor.java:724) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processSimplePath(ProfilePathProcessor.java:219) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:171) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864) at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)

fsh: `// Extension Extension: Extension1 Id: Extension-1 Title: "Title" Description: "Desc"

//target for extensions valueCanonical Profile: CompositionOutput Parent: Composition Id: composition2

//Throws error Profile: CompositionOutput2 Parent: Composition Id: composition Title: "Composition" Description: "A profile on the Composition resource"

lmckenzi commented 1 year ago

Can you please point to a Git repository that reproduces this? (A single FSH file isn't enough to allow us to reproduce.)

VictorShiller commented 1 year ago

@lmckenzi a repo that reproduces this error: https://github.com/VictorShiller/IG-Sample2

grahamegrieve commented 1 year ago
FHIR IG Publisher Version 1.3.1-SNAPSHOT (Git# 3b2c78368cc6). Built 2023-03-23T04:32:19.872+11:00 (63 days old)
Detected Java version: 17.0.2 from /Users/grahamegrieve/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.aarch64_17.0.2.v20220201-1208/jre on Mac OS X/aarch64 (64bit). 16384MB available
dir = /Users/grahamegrieve/work/ig-pub/org.hl7.fhir.publisher.core, path = /usr/bin:/bin:/usr/sbin:/sbin
Parameters: -ig /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master
Start Clock @ Thursday, 25 May 2023 at 6:57:05 am Australian Eastern Standard Time (2023-05-25T06:57:05+10:00)

Build FHIR IG from /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master (00:00.013)
API keys loaded from /Users/grahamegrieve/.fhir/fhir-settings.json               (00:00.014)
Package Cache: /Users/grahamegrieve/.fhir/packages                               (00:00.018)
Run Sushi on /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master       (00:00.022)
Unable to load IG as an r5 IG - try R4 (/Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json (No such file or directory)) (00:00.499)
Publishing Content Failed: Error Parsing File /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json: /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json (No such file or directory) (00:00.526)
                                                                                 (00:00.526)
Use -? to get command line help                                                  (00:00.527)
                                                                                 (00:00.527)
Stack Dump (for debugging):                                                      (00:00.527)
java.lang.Exception: Error Parsing File /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json: /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json (No such file or directory)
    at org.hl7.fhir.igtools.publisher.Publisher.initializeFromIg(Publisher.java:2407)
    at org.hl7.fhir.igtools.publisher.Publisher.initialize(Publisher.java:2287)
    at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:923)
    at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:11384)
Caused by: java.io.FileNotFoundException: /Users/grahamegrieve/temp/igs/VictorShiller-IG-Sample2#master/fsh-generated/resources/ImplementationGuide-sample.fhir.json (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at org.hl7.fhir.utilities.TextFile.fileToBytes(TextFile.java:208)
    at org.hl7.fhir.r4.formats.FormatUtilities.loadFile(FormatUtilities.java:168)
    at org.hl7.fhir.igtools.publisher.Publisher.initializeFromIg(Publisher.java:2404)
    ... 3 more

@cmoesel sushi failed somehow?

VictorShiller commented 1 year ago

Output when I run _genonce.sh


  Online

  Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8
  FHIR IG Publisher Version 1.3.2 (Git# 60cb067f5635). Built 2023-03-25T13:13:01.551Z (60 days old)
  Detected Java version: 17.0.5 from C:\Program Files\Java\jdk-17.0.5 on Windows 10/amd64 (64bit). 16352MB available
  dir = C:\Users\shillev\source\repos\github.com\IG-Sample, path = C:\Users\shillev\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\shillev\bin;C:\Program Files\Java\jdk-17.0.5\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\shillev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\nodejs;C:\Program Files (x86)\Webex\Plugins;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C:\Program Files\1E\Client\Extensibility\NomadBranch;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Java\jdk-17.0.5\bin;C:\Users\shillev\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\shillev\AppData\Local\Programs\Python\Python37;C:\Ruby27-x64\bin;C:\Users\shillev\AppData\Local\Microsoft\WindowsApps;C:\Users\shillev\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Users\shillev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\shillev\AppData\Roaming\npm;C:\Program Files\Azure Data Studio\bin;C:\Users\shillev\.dotnet\tools;C:\Users\shillev\AppData\Local\Programs\Fiddler;C:\Users\shillev\.dotnet\tools;C:\Users\shillev\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
  Parameters: -ig .
  Start Clock @ Wednesday, May 24, 2023 at 4:04:23 PM Central Daylight Time (2023-05-24T16:04:23-05:00)

  Build FHIR IG from C:\Users\shillev\source\repos\github.com\IG-Sample\.          (00:00.160)
  API keys loaded from C:\Users\shillev\fhir-api-keys.ini                          (00:00.318)
  Package Cache: C:\Users\shillev\.fhir\packages                                   (00:00.323)
  Run Sushi on C:\Users\shillev\source\repos\github.com\IG-Sample                  (00:00.471)
  Sushi: info  Running SUSHI v2.10.2 (implements FHIR Shorthand specification v2.0.0) (00:24.679)
  Sushi: info  Arguments:                                                          (00:24.680)
  Sushi: info    --out C:\Users\shillev\source\repos\github.com\IG-Sample          (00:24.681)
  Sushi: info    C:\Users\shillev\source\repos\github.com\IG-Sample                (00:24.683)
  Sushi: info  Using configuration file: C:\Users\shillev\source\repos\github.com\IG-Sample\sushi-config.yaml (00:28.144)
  Sushi: info  Importing FSH text...                                               (00:28.154)
  Sushi: info  Preprocessed 1 documents with 0 aliases.                            (00:28.204)
  Sushi: info  Imported 3 definitions and 0 instances.                             (00:28.211)
  Sushi: info  Checking local cache for hl7.fhir.uv.tools#current...               (00:28.212)
  Sushi: info  Found hl7.fhir.uv.tools#current in local cache.                     (00:28.237)
  Sushi: (node:31296) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:28.271)
  Sushi: (Use `node --trace-warnings ...` to show where the warning was created)   (00:28.273)
  Sushi: (node:31296) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:28.274)
  Sushi: info  Loaded package hl7.fhir.uv.tools#current                            (00:29.163)
  Sushi: info  Checking local cache for hl7.terminology.r4#5.0.0...                (00:30.658)
  Sushi: info  Found hl7.terminology.r4#5.0.0 in local cache.                      (00:31.963)
  Sushi: info  Loaded package hl7.terminology.r4#5.0.0                             (00:31.964)
  Sushi: info  Checking local cache for hl7.fhir.r4.core#4.0.1...                  (00:31.965)
  Sushi: info  Found hl7.fhir.r4.core#4.0.1 in local cache.                        (00:33.523)
  Sushi: info  Loaded package hl7.fhir.r4.core#4.0.1                               (00:33.524)
  Sushi: info  Converting FSH to FHIR resources...                                 (00:33.603)
  Sushi: info  Converted 3 FHIR StructureDefinitions.                              (00:33.839)
  Sushi: info  Exporting FHIR resources as JSON...                                 (00:33.840)
  Sushi: info  Exported 3 FHIR resources as JSON.                                  (00:33.865)
  Sushi: info  Assembling Implementation Guide sources...                          (00:33.866)
  Sushi: info  Generated ImplementationGuide-sample.fhir.json                      (00:33.874)
  Sushi: info  Assembled Implementation Guide sources; ready for IG Publisher.     (00:33.876)
  Sushi:                                                                           (00:33.877)
  Sushi: ========================= SUSHI RESULTS ===========================       (00:33.878)
  Sushi: |  -------------------------------------------------------------  |       (00:33.879)
  Sushi: | |    Profiles   |  Extensions  |   Logicals   |   Resources   | |       (00:33.880)
  Sushi: | |-------------------------------------------------------------| |       (00:33.881)
  Sushi: | |       2       |      1       |      0       |       0       | |       (00:33.882)
  Sushi: |  -------------------------------------------------------------  |       (00:33.883)
  Sushi: |  -------------------------------------------------------------  |       (00:33.885)
  Sushi: | |      ValueSets     |    CodeSystems    |     Instances      | |       (00:33.886)
  Sushi: | |-------------------------------------------------------------| |       (00:33.886)
  Sushi: | |         0          |         0         |         0          | |       (00:33.887)
  Sushi: |  -------------------------------------------------------------  |       (00:33.888)
  Sushi: |                                                                 |       (00:33.890)
  Sushi: ===================================================================       (00:33.891)
  Sushi: | You're piranha roll now!               0 Errors      0 Warnings |       (00:33.892)
  Sushi: ===================================================================       (00:33.893)
  Sushi:                                                                           (00:33.895)
  Unable to load IG as an r5 IG - try R4 (property code is a class com.google.gson.JsonPrimitive looking for an object) (00:45.267)
  Load Template from fhir.base.template#current                                    (00:45.768)

  onLoad.findSpreadsheets:

  onLoad.updateIg:
      [xslt] Processing C:\Users\shillev\source\repos\github.com\IG-Sample\template\onLoad-ig-working.xml to C:\Users\shillev\source\repos\github.com\IG-Sample\template\onLoad-ig-updated.xml
      [xslt] Loading stylesheet C:\Users\shillev\source\repos\github.com\IG-Sample\template\scripts\onLoad.xslt

  onLoad.extend:

  onLoad:
  Root directory: C:\Users\shillev\source\repos\github.com\IG-Sample               (00:50.517)
  Core Package hl7.fhir.r4.core#4.0.1
  .:Terminology Cache is at C:\Users\shillev\source\repos\github.com\IG-Sample\input-cache\txcache. 21 files in cache (00:56.354)
  Connect to Terminology Server at http://tx.fhir.org                              (00:56.357)
  Load Package hl7.fhir.pubpack#0.1.4
  Load Package hl7.fhir.xver-extensions#0.0.12
  Load Package hl7.terminology.r4#5.0.0
  Version mismatch. This IG is version 4.0.1, while the IG 'igtools' is from version 5.0.0 (will try to run anyway) (00:59.034)
  Load Package hl7.fhir.uv.tools#0.1.0
  Load R5 Extensions - 157 resources (01:07.705)
  Initialization complete                                                          (01:08.716)
  Fetch http://test.com/fhir/sample/package-list.json for version check            (01:08.718)
  Load Content                                                                     (01:23.887)
  loadPrePages from FetchedFile[C:\Users\shillev\source\repos\github.com\IG-Sample\fsh-generated\includes] as C:\Users\shillev\source\repos\github.com\IG-Sample\fsh-generated\includes
  loadPrePages from FetchedFile[C:\Users\shillev\source\repos\github.com\IG-Sample\input\pagecontent] as C:\Users\shillev\source\repos\github.com\IG-Sample\input\pagecontent
  Processing Conformance Resources                                                 (01:24.287)
  Generating Snapshots                                                             (01:24.390)
  Exception in thread "main" java.lang.StackOverflowError
    at org.hl7.fhir.r5.model.ElementDefinition$ElementDefinitionSlicingDiscriminatorComponent.copyValues(ElementDefinition.java:1640)
    at org.hl7.fhir.r5.model.ElementDefinition$ElementDefinitionSlicingDiscriminatorComponent.copy(ElementDefinition.java:1635)
    at org.hl7.fhir.r5.model.ElementDefinition$ElementDefinitionSlicingComponent.copyValues(ElementDefinition.java:1382)
    at org.hl7.fhir.r5.model.ElementDefinition$ElementDefinitionSlicingComponent.copy(ElementDefinition.java:1373)
    at org.hl7.fhir.r5.model.ElementDefinition.copyValues(ElementDefinition.java:12581)
    at org.hl7.fhir.r5.model.ElementDefinition.copy(ElementDefinition.java:12561)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:884)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:864)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:179)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1067)
  ....................... (same recurring set of errors)```
cmoesel commented 1 year ago

@grahamegrieve - Why are you running IG Publisher 1.3.1-SNAPSHOT (built March 23)? I've just tried it with IG Publisher 1.3.12 (built May 24) and it worked fine for me.

@VictorShiller - I'm not getting any errors when I run _genonce. I'm on Mac with Java 11, but I wouldn't think that would make a difference.

I also noticed you have a fsh.ini file with sushi-version=latest. I guess that's valid, but I don't think it's common. You may want to consider removing that (~and don't worry, the IG Publisher will bark at you if your installed SUSHI is out of date~ edit: IG Publisher only barks in publication or auto-build mode, neither of which are used during normal development).

grahamegrieve commented 1 year ago

@cmoesel - it's the latest running under the java debugger. the version is just wrong in that case. Sushi bombed with no error message because it wasn't current - not sure what happened there

@VictorShiller it builds fine for me too. FHIR IG Publisher Version 1.3.2 is extremely old - update to the current version

cmoesel commented 1 year ago

@grahamegrieve - Ah... ok. That is weird that you didn't get any out-of-date errors from SUSHI. I ran with the -publish flag (to force the --require-latest flag on SUSHI) and I got the error in my output:

error Current SUSHI version (2.10.0) is not the latest version. Upgrade to the latest version (2.10.2) or run SUSHI again without the --require-latest flag. (00:01.188)
VictorShiller commented 1 year ago

updated IG Publisher to latest and the error slightly changed. I also noticed when I comment out section[section1].section[section2].extension[abc].valueCanonical = Canonical(CompositionOutput) line 34 in composition.fsh it builds.

It seems that something about setting the valueCononical of my extension on the Composition profile is causing it to fail, I am on windows behind a corporate proxy, though that should not affect this error.

Checking internet connection...
Online

Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8
FHIR IG Publisher Version 1.3.12 (Git# d881c69d4461). Built 2023-05-24T15:44:32.700Z (22 hours old)
Detected Java version: 17.0.5 from C:\Program Files\Java\jdk-17.0.5 on Windows 10/amd64 (64bit). 16352MB available
dir = C:\Users\shillev\source\repos\github.com\IG-Sample, path = C:\Users\shillev\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\shillev\bin;C:\Program Files\Java\jdk-17.0.5\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\shillev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\nodejs;C:\Program Files (x86)\Webex\Plugins;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C:\Program Files\1E\Client\Extensibility\NomadBranch;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Java\jdk-17.0.5\bin;C:\Users\shillev\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\shillev\AppData\Local\Programs\Python\Python37;C:\Ruby27-x64\bin;C:\Users\shillev\AppData\Local\Microsoft\WindowsApps;C:\Users\shillev\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Users\shillev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\shillev\AppData\Roaming\npm;C:\Program Files\Azure Data Studio\bin;C:\Users\shillev\.dotnet\tools;C:\Users\shillev\AppData\Local\Programs\Fiddler;C:\Users\shillev\.dotnet\tools;C:\Users\shillev\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
Parameters: -ig .
Start Clock @ Thursday, May 25, 2023 at 9:26:22 AM Central Daylight Time (2023-05-25T09:26:22-05:00)

Build FHIR IG from C:\Users\shillev\source\repos\github.com\IG-Sample\.          (00:00.184)
API keys loaded from C:\Users\shillev\.fhir\fhir-settings.json                   (00:00.186)
Package Cache: C:\Users\shillev\.fhir\packages                                   (00:00.190)
Run Sushi on C:\Users\shillev\source\repos\github.com\IG-Sample                  (00:00.365)
Sushi: info  Running SUSHI v2.10.2 (implements FHIR Shorthand specification v2.0.0) (00:23.031)
Sushi: info  Arguments:                                                          (00:23.032)
Sushi: info    --out C:\Users\shillev\source\repos\github.com\IG-Sample          (00:23.033)
Sushi: info    C:\Users\shillev\source\repos\github.com\IG-Sample                (00:23.034)
Sushi: info  Using configuration file: C:\Users\shillev\source\repos\github.com\IG-Sample\sushi-config.yaml (00:26.579)
Sushi: info  Importing FSH text...                                               (00:26.593)
Sushi: info  Preprocessed 1 documents with 0 aliases.                            (00:26.649)
Sushi: info  Imported 3 definitions and 0 instances.                             (00:26.653)
Sushi: info  Checking local cache for hl7.fhir.uv.tools#current...               (00:26.655)
Sushi: info  Found hl7.fhir.uv.tools#current in local cache.                     (00:26.681)
Sushi: (node:6448) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:26.712)
Sushi: (Use `node --trace-warnings ...` to show where the warning was created)   (00:26.714)
Sushi: (node:6448) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:26.715)
Sushi: info  Loaded package hl7.fhir.uv.tools#current                            (00:27.575)
Sushi: info  Checking local cache for hl7.terminology.r4#5.0.0...                (00:28.326)
Sushi: info  Found hl7.terminology.r4#5.0.0 in local cache.                      (00:29.632)
Sushi: info  Loaded package hl7.terminology.r4#5.0.0                             (00:29.633)
Sushi: info  Checking local cache for hl7.fhir.r4.core#4.0.1...                  (00:29.634)
Sushi: info  Found hl7.fhir.r4.core#4.0.1 in local cache.                        (00:31.069)
Sushi: info  Loaded package hl7.fhir.r4.core#4.0.1                               (00:31.070)
Sushi: info  Converting FSH to FHIR resources...                                 (00:31.125)
Sushi: info  Converted 3 FHIR StructureDefinitions.                              (00:31.322)
Sushi: info  Exporting FHIR resources as JSON...                                 (00:31.324)
Sushi: info  Exported 3 FHIR resources as JSON.                                  (00:31.347)
Sushi: info  Assembling Implementation Guide sources...                          (00:31.348)
Sushi: info  Generated ImplementationGuide-sample.fhir.json                      (00:31.358)
Sushi: info  Assembled Implementation Guide sources; ready for IG Publisher.     (00:31.359)
Sushi:                                                                           (00:31.360)
Sushi: ========================= SUSHI RESULTS ===========================       (00:31.361)
Sushi: |  -------------------------------------------------------------  |       (00:31.362)
Sushi: | |    Profiles   |  Extensions  |   Logicals   |   Resources   | |       (00:31.364)
Sushi: | |-------------------------------------------------------------| |       (00:31.365)
Sushi: | |       2       |      1       |      0       |       0       | |       (00:31.366)
Sushi: |  -------------------------------------------------------------  |       (00:31.367)
Sushi: |  -------------------------------------------------------------  |       (00:31.368)
Sushi: | |      ValueSets     |    CodeSystems    |     Instances      | |       (00:31.369)
Sushi: | |-------------------------------------------------------------| |       (00:31.370)
Sushi: | |         0          |         0         |         0          | |       (00:31.371)
Sushi: |  -------------------------------------------------------------  |       (00:31.372)
Sushi: |                                                                 |       (00:31.373)
Sushi: ===================================================================       (00:31.373)
Sushi: | Fin-tastic job!                        0 Errors      0 Warnings |       (00:31.374)
Sushi: ===================================================================       (00:31.375)
Sushi:                                                                           (00:31.376)
Unable to load IG as an r5 IG - try R4 (property code is a class com.google.gson.JsonPrimitive looking for an object) (00:42.376)
Load Template from fhir.base.template#current                                    (00:42.900)

onLoad.findSpreadsheets:

onLoad.updateIg:
     [xslt] Processing C:\Users\shillev\source\repos\github.com\IG-Sample\template\onLoad-ig-working.xml to C:\Users\shillev\source\repos\github.com\IG-Sample\template\onLoad-ig-updated.xml
     [xslt] Loading stylesheet C:\Users\shillev\source\repos\github.com\IG-Sample\template\scripts\onLoad.xslt

onLoad.extend:

onLoad:
Root directory: C:\Users\shillev\source\repos\github.com\IG-Sample               (00:47.538)
Core Package hl7.fhir.r4.core#4.0.1
Terminology Cache is at C:\Users\shillev\source\repos\github.com\IG-Sample\input-cache\txcache. 21 files in cache (00:53.618)
Connect to Terminology Server at http://tx.fhir.org                              (00:53.621)
Load Package hl7.fhir.pubpack#0.1.4
Load Package hl7.fhir.xver-extensions#0.0.12
Load Package hl7.terminology.r4#5.0.0
Load Package hl7.fhir.uv.extensions.r4#1.0.0
Version mismatch. This IG is version 4.0.1, while the IG 'igtools' is from version 5.0.0 (will try to run anyway) (00:56.879)
Load Package hl7.fhir.uv.tools#0.1.0
Load R5 SpecialsInitialization complete                                                          (01:00.864)
Fetch http://test.com/fhir/sample/package-list.json for version check            (01:00.866)
Load Content                                                                     (01:15.937)
loadPrePages from FetchedFile[C:\Users\shillev\source\repos\github.com\IG-Sample\fsh-generated\includes] as C:\Users\shillev\source\repos\github.com\IG-Sample\fsh-generated\includes
loadPrePages from FetchedFile[C:\Users\shillev\source\repos\github.com\IG-Sample\input\pagecontent] as C:\Users\shillev\source\repos\github.com\IG-Sample\input\pagecontent
Processing Conformance Resources                                                 (01:16.367)
Generating Snapshots                                                             (01:16.483)
Exception in thread "main" java.lang.StackOverflowError
    at org.hl7.fhir.r5.context.CanonicalResourceManager.get(CanonicalResourceManager.java:491)
    at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithExceptionByVersion(BaseWorkerContext.java:1592)
    at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithException(BaseWorkerContext.java:1473)
    at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResource(BaseWorkerContext.java:1949)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.fetchResource(SimpleWorkerContext.java:681)
    at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2089)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1071)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1119)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1119)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1119)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1119)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1119)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:910)
    at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:183)
....
grahamegrieve commented 1 year ago

well, I'm not going to look at this unless you provide a git repository that reproduces this error exactly

AymericGrassart commented 11 months ago

Hi @grahamegrieve , @cmoesel, @lmckenzi, I am able to reproduce the error with @VictorShiller's repo using the latest FHIR IG Publisher Version 1.5.5.

Just to confirm from a FHIR specification point of view, are extensions supported on recursive fields using slicing to target specific levels? My tests have shown that it works at the root and second level, yet breaks at the third level.

Here is a fsh example redacted from the repo that demonstrates the issue:

Extension:        Extension1
Id:               extension-1
Title:            "Title"
Description:      "Desc"
* value[x] 1..1 MS
* value[x] only string

Profile:        CompositionProfile
Parent:         Composition
Id:             composition-profile
Title:          "Composition"
Description:    "A profile on the Composition resource"

* section.extension contains Extension1 named abc 0..1 MS
* section.extension[abc].valueString = "parent works"

* section ^slicing.discriminator.type = #pattern
* section ^slicing.discriminator.path = "$this"
* section ^slicing.rules = #open
* section contains 
    section1 0..1 MS

* section[section1].extension contains Extension1 named abc1 0..1 MS
* section[section1].extension[abc1].valueString = "level 1 child works"

* section[section1].section ^slicing.discriminator.type = #pattern
* section[section1].section ^slicing.discriminator.path = "$this"
* section[section1].section ^slicing.rules = #open
* section[section1].section contains 
    section2 0..1 MS

* section[section1].section[section2].extension contains Extension1 named abc2 0..1 MS
//Throws error 
* section[section1].section[section2].extension[abc2].valueString = "level 2 child fails"

stacktrace from repo:

Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8
FHIR IG Publisher Version 1.5.5 (Git# 3db07b9b9942). Built 2023-11-24T21:11:01.665Z (13 days old)   
Detected Java version: 17.0.2
...
Generating Snapshots                                                                                 (00:00.002 / 01:03.000, 528Mb)
Exception in thread "main" java.lang.StackOverflowError
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.checkExtensionDoco(ProfileUtilities.java:1725)
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2358)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1151)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:988)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:184)
...

varying stacktraces from example fsh above:

Generating Snapshots                                                                                 (00:00.002 / 01:02.161, 741Mb)
Exception in thread "main" java.lang.StackOverflowError
        at java.base/java.lang.String.startsWith(String.java:2297)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithExceptionByVersion(BaseWorkerContext.java:1835)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithException(BaseWorkerContext.java:1827)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResource(BaseWorkerContext.java:2328)
        at org.hl7.fhir.r5.context.SimpleWorkerContext.fetchResource(SimpleWorkerContext.java:708)
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2390)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1151)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:988)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:184)
...
Generating Snapshots                                                                                 (00:00.001 / 01:02.023, 408Mb)
Exception in thread "main" java.lang.StackOverflowError
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.checkExtensionDoco(ProfileUtilities.java:1725)
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2358)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1151)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:988)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:184)
...
Generating Snapshots                                                                                 (00:00.001 / 01:04.250, 616Mb)
Exception in thread "main" java.lang.StackOverflowError
        at java.base/java.util.HashMap.getNode(HashMap.java:570)
        at java.base/java.util.HashMap.containsKey(HashMap.java:594)
        at org.hl7.fhir.r5.context.CanonicalResourceManager.get(CanonicalResourceManager.java:516)
        at org.hl7.fhir.r5.context.CanonicalResourceManager.get(CanonicalResourceManager.java:525)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithExceptionByVersion(BaseWorkerContext.java:1962)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResourceWithException(BaseWorkerContext.java:1827)
        at org.hl7.fhir.r5.context.BaseWorkerContext.fetchResource(BaseWorkerContext.java:2328)
        at org.hl7.fhir.r5.context.SimpleWorkerContext.fetchResource(SimpleWorkerContext.java:708)
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2390)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1151)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:988)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:184)
...
Generating Snapshots                                                                                 (00:00.003 / 01:05.602, 621Mb)
Exception in thread "main" java.lang.StackOverflowError
        at org.hl7.fhir.r5.model.Base.setUserData(Base.java:164)
        at org.hl7.fhir.r5.conformance.profile.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:2352)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBaseDefault(ProfilePathProcessor.java:1151)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPathWithSlicedBase(ProfilePathProcessor.java:988)
        at org.hl7.fhir.r5.conformance.profile.ProfilePathProcessor.processPaths(ProfilePathProcessor.java:184)
...
grahamegrieve commented 11 months ago

I can't reproduce the error with 1.5.6, though I don't think I changed anything of relevance. Can anyone provide a repository that demonstrates the problem?

gauravgso commented 8 months ago

I am getting the same error. The packages at https://simplifier.net/packages (https://packages.fhir.org/) hl7.fhir.r4.core 4.0.1 does not match with the one present at https://hl7.org/fhir/R4/downloads.html which was causing the error.

The one from package.fhir.org does not work.