microsoft/fhir-codegen

FHIR download/caching barfing on R5 500 error.

preston opened this issue · 1 comments

On first run, the download/caching code is bailing out with TryDownloadAndExtract <<< exception downloading: http://packages2.fhir.org/packages/hl7.fhir.r5.core/5.0.0-snapshot2/, One or more errors occurred. (Response status code does not indicate success: 500 (Internal Server Error).). Not sure if it's an upstream issue with the server, outdated URL etc.

`
➜ fhir-codegen git:(main) dotnet run -p src/fhir-codegen-cli
Warning NETSDK1174: The abbreviation of -p for --project is deprecated. Please use --project.
Starting FhirCacheService...
<<< using cache directory: /Users/preston/.fhir
<< cache contains 10 packges
Starting FhirManager...
LoadCached <<< Loaded and Parsed FHIR DSTU2
Loaded hl7.fhir.r2.core#latest as hl7.fhir.r2.core version 1.0.2
LoadCached <<< Loaded and Parsed FHIR STU3 with 0 errors and 5 warnings
Errors (only able to pass with manual code changes)
Warnings (able to pass, but should be reviewed)

  • CodeSystem SNOMED_CT (snomedct): Duplicate proprety found: Laterality
  • ValueSet Yes/No/Don't Know (yesnodontknow): No Version present
  • ValueSet Example-inactive (inactive): No Version present
  • ValueSet Common UCUM units (ucum-common): No Version present
  • ValueSet All CPT codes (cpt-all): No Version present
    Loaded hl7.fhir.r3.core#latest as hl7.fhir.r3.core version 3.0.2
    LoadCached <<< Loaded and Parsed FHIR R4 with 0 errors and 1 warnings
    Errors (only able to pass with manual code changes)
    Warnings (able to pass, but should be reviewed)
  • CodeSystem SNOMED_CT (snomedct): Duplicate proprety found: Laterality
    Loaded hl7.fhir.r4.core#latest as hl7.fhir.r4.core version 4.0.1
    GetPackageVersionsAndUrls <<< Failed to get package info: NotFound http://packages.fhir.org/hl7.fhir.r4b.core
    GetPackageVersionsAndUrls <<< Failed to get package info: NotFound http://packages.fhir.org/hl7.fhir.r4b.expansions
    LoadCached <<< Loaded and Parsed FHIR R4B with 4 errors and 6 warnings
    Errors (only able to pass with manual code changes)
  • CodeSystem ResourceSecurityCategory (resource-security-category): Status field missing
  • CodeSystem ConceptSubsumptionOutcome (concept-subsumption-outcome): Status field missing
  • CodeSystem StandardsStatus (standards-status): Status field missing
  • CodeSystem ResourceValidationMode (resource-validation-mode): Status field missing
    Warnings (able to pass, but should be reviewed)
  • CodeSystem SNOMED_CT (snomedct): Duplicate proprety found: Laterality
  • ValueSet Yes/No/Don't Know (yesnodontknow): No Version present
  • ValueSet ACMECholCodesPlasma (example-filter): No Version present
  • ValueSet Example-inactive (inactive): No Version present
  • ValueSet Common UCUM units (ucum-common): No Version present
  • ValueSet All CPT codes (cpt-all): No Version present
    Loaded hl7.fhir.r4b.core#latest as hl7.fhir.r4b.core version 4.3.0-snapshot1
    GetPackageVersionsAndUrls <<< Failed to get package info: NotFound http://packages.fhir.org/hl7.fhir.r5.core
    TryDownloadAndExtract <<< exception downloading: http://packages.fhir.org/hl7.fhir.r5.core/5.0.0-snapshot2/, One or more errors occurred. (Response status code does not indicate success: 404 (Not Found).)
    <<< inner: Response status code does not indicate success: 404 (Not Found).
    TryDownloadAndExtract <<< exception downloading: http://packages2.fhir.org/packages/hl7.fhir.r5.core/5.0.0-snapshot2/, One or more errors occurred. (Response status code does not indicate success: 500 (Internal Server Error).)
    <<< inner: Response status code does not indicate success: 500 (Internal Server Error).
    FindOrDownload <<< unable to resolve a directive: hl7.fhir.r5.core#latest
    Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    ---> System.Exception: Failed to retrieve hl7.fhir.r5.core#latest
    at Microsoft.Health.Fhir.SpecManager.Manager.FhirManager.LoadFhirCore(FhirSequenceEnum sequence, String version, Boolean offlineMode, Boolean officialExpansionsOnly, String ciBranch) in /Users/preston/Developer/git/fhir-codegen/src/Microsoft.Health.Fhir.SpecManager/Manager/FhirManager.cs:line 351
    at Microsoft.Health.Fhir.SpecManager.Manager.FhirManager.LoadPackages(IEnumerable1 packageDirectives, Boolean offlineMode, Boolean officialExpansionsOnly, Boolean loadDependencies, Boolean skipFhirCore, String ciBranch, List1& failedPackages, Boolean areDependencies) in /Users/preston/Developer/git/fhir-codegen/src/Microsoft.Health.Fhir.SpecManager/Manager/FhirManager.cs:line 495
    at FhirCodegenCli.Program.Process(String fhirSpecDirectory, String outputPath, Boolean verbose, Boolean offlineMode, String language, String exportKeys, String loadR2, String loadR3, String loadR4, String loadR4B, String loadR5, String languageOptions, Boolean officialExpansionsOnly, String fhirServerUrl, Boolean includeExperimental, String exportTypes, String extensionSupport, Boolean languageHelp, String packageDirectory, String packages, String ciBranch, String languageInputDir) in /Users/preston/Developer/git/fhir-codegen/src/fhir-codegen-cli/Program.cs:line 464
    --- End of inner exception stack trace ---
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.Delegate.DynamicInvokeImpl(Object[] args)
    at System.Delegate.DynamicInvoke(Object[] args)
    at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
    at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass26_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__23_0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass21_0.<b__0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__8_0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__7_0>d.MoveNext()
    --- End of stack trace from previous location ---
    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<b__0>d.MoveNext()

`

Thought I had already merged that fix into main. There is an invalid package listed in the registry: 5.0.0-snapshot2. I believe it is what Grahame uses internally for his tooling, but the directive changed when he published ballot, and it was not being filtered out. The detection is more robust now, so this should hopefully suffice as new versions are published.

I merged the changes into main (they were already on dev) and all appears to be working.