A city must be right next to the coast, one tile away from the coast means the 2 tile radius will have some water tiles, but since its not on the coast you can't build a harbor. (never build cities 1 tile away from the coast)
If a city is right next to a body of water, check if it is fresh water. Right-click on a tile and it should show it.
A fresh water body is a lake, and lakes don't count, it must be a sea or ocean.