As part of the $package operation processing, the PackageVisitor.handleValueSets method calls the ExpandHelper.expandValueSet method. In the case that the ValueSet's definition contains both a ValueSet reference and explicit code includes (i.e., it has neither a "simple compose" nor a "grouping compose"), it invokes the $expand operation (ValueSetOperationProvider.expand) via HapiFhirRepository.invoke. Then, in BaseResourceReturningMethodBinding.doInvokeServer, the RequestDetails are mapped into method parameters. The problem is that the RequestDetails are those of the outer $package request, so 'theID' is the ID of the Library being packaged. The expansion parameters include the VS URL and Version. JpaResourceDaoValueSet.expand explicitly disallows having both the ID and URL.
Steps to reproduce:
- Post a package that includes a Library (manifest) that references a ValueSet whose definition includes both explicit code includes and a ValueSet reference.
- Invoke Library.$package on the Library
- Expansion of the referenced ValueSet should fail for the reason described above