diff --git a/src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java b/src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
+++ b/src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
@@ -421,7 +421,11 @@ public class JdbcTableWriter implements TableWriter {
             // field statement above.
             for (Field field : subTable.specFields()) {
                 if (field.referenceTable != null && !field.referenceTable.name.equals(specTable.name)) {
-                    referencesPerTable.put(field.referenceTable, subEntity.get(field.name).asText());
+                    JsonNode refValueNode = subEntity.get(field.name);
+                    // Skip over references that are null but not required (e.g., route_id in fare_rules).
+                    if (refValueNode.isNull() && !field.isRequired()) continue;
+                    String refValue = refValueNode.asText();
+                    referencesPerTable.put(field.referenceTable, refValue);
                 }
             }
             // Insert new sub-entity.
fix(editor): allow null values for foreign ref fields allowed to be empty

This fixes a bug where create/update requests with foreign refs (such as route_id in fare_rules)
could not be null even if the table definition permits the null value.

fixes catalogueglobal/datatools-ui#<I>