There is first a physics answer, and then a mathematics answer.
The physics answer is that there is no such thing as a massless rope. As soon as you allow the rope to have some mass, no matter how small, your argument no longer works.
Now, it is quite common to invoke the idea of a "massless" or "weightless" rope in arguments involving force and acceleration. What is really going on in such a case is that one is considering a situation where the mass of the rope is negligible in comparison to some other mass which is also in the system under consideration. In the situation you described there are no other masses with which to make the comparison, so this idea of comparison is not available. Hence the concept is not applicable.
Now for a further comment on the mathematics. There are many situations in mathematics where apparent contradictions can arise, owing to a mistake involving the number zero. In this example you have
F = m a
and with $m = 0$ you are right that one would normally conclude $F=0$. But in the present example we have another consideration: it is the possibility that $a$ might not be a finite number. If $a$ is infinite then you have the combination $0 \times \infty$ and such a quantity is formally undefined. To fill this out a little, consider not a zero mass but a small mass. Then you have
a = F / m
so if the mass is small the acceleration is large. For any given amount of force, as $m$ gets smaller, $a$ gets larger, in such a way that $m a$ is constant and equal to the force. So in the limit of $m \rightarrow 0$ then indeed in this example you have $a \rightarrow \infty$. So that is the mathematical solution to your puzzle. It is a case where caution is required regarding the combination of zero and infinity.