This issue is similar to - #798
A foundation had resource issues several months ago and has numerous apps with package state InsufficientResources. The resource issue has been resolved but automation which leverage cf-java-client is continuing to report error:
PivotalClientApiException: Exception occurred while getting application: , Error: CF-InsufficientResources(170008): Insufficient resources
The current implementation of getApplicationInstances handles errors like CF_BUILDPACK_COMPILED_FAILED and CF_INSTANCES_ERROR that can be returned from CC if the staging previously failed. However, the InsufficientResources (error code 170008) is not handled and will throw an exception when fetching application instances.
cf-java-client/cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/applications/DefaultApplications.java