if the foam is white my guess is that it is nitrites or high nitrates. I've seen this is numerous tanks that were "cycled" and had a mysterious foam on top. Had them bring in a water sample and it was always high nitrites or nitrates. Regular water change schedule maintained and all of them were back in business.