Obviously there are cases where there is a valid issue however Eclipse throws this error for no good reason sometimes. This is still (in v 2020-09) an old (2010) Eclipse bug that can be resolved by making a negligible change to the project settings.
touch .classpath
solves the issue, or go to Project > Properties > Java Build Path > Order and Export > make a meaningless order change > Apply. Changing the order back does not regress to the problem.