diff --git a/src/main/java/org/mitre/synthea/world/concepts/PreferredProviders.java b/src/main/java/org/mitre/synthea/world/concepts/PreferredProviders.java index af51a162ce..20d0db13e0 100644 --- a/src/main/java/org/mitre/synthea/world/concepts/PreferredProviders.java +++ b/src/main/java/org/mitre/synthea/world/concepts/PreferredProviders.java @@ -61,6 +61,11 @@ public Provider startNewRelationship(Person person, HealthRecord.EncounterType t provider = Provider.findService(person, HealthRecord.EncounterType.INPATIENT, speciality, time); } + if (provider == null) { + throw new IllegalStateException( + String.format("Unable to find provider for encounter type '%s' and specialty '%s'", + type, speciality)); + } relationships.put(type, blankSafeSpecialty(speciality), provider);