Unit tests would have picked up some of these issues. For future scripts, start with unit tests. Take a subset of the real data by creating a testing shapefile, then clip all the data to that file, eg,
if testing:
for layer in input_layers:
Clip_analysis (in_features, clip_features, out_feature_class, {cluster_tolerance})
Parse csv files to make sure they as expected. Check the class of fields to see that they are as expected.
This will keep folds working and increase readability.