Can the rank of a module be equal to zero? I try to understand a proof from one of my lectures.

Let $\mathcal{O}_K$ be the ring of integers over a field $K$ and $0 \neq \mathfrak{a} \subseteq \mathcal{O}_K$ an ideal.

I know that $\mathcal{O}_K$ is a free $\mathbb{Z}$-module of rank $r := [\mathcal{O}_K : \mathbb{Q}]$. Hence $rank(\mathfrak{a}) \leq r$ as a free $\mathbb{Z}$-module. On the other side $\mathfrak{a}\mathcal{O}$ is a free $\mathbb{Z}$-module of rank $r$. So in total $rank(\mathfrak{a}) = r$.

Let's observe $rank(\mathcal{O_K}/\mathfrak{a})$. My notes states that this rank is zero, hence $\mathcal{O_K}/\mathfrak{a}$ is finitely generated, but for me this doesn't make any sense. By my definition of rank (counting the number of basis elements), the smallest rank possible is 1, isn't it? Is my definition of rank wrong?

What am I missing here?
Beyond the fact that the zero-module indeed has rank $0$, it is relevant to note that not every module has a basis and thus one needs to be a bit carefull what the rank should be. 

Let us take a basic example with $K$ equal to the rationals, then the ring of integers is just the integers $\mathbb{Z}$. Now for some ideal of the integers, say the one generated by $5$, we have that $5 \mathbb{Z}$ has rank $1$. Yet the quotient $\mathbb{Z}/5\mathbb{Z}$ is not free as a  $\mathbb{Z}$-module and thus has no basis and not even any non-trivial free submodule or independent subset. 

This is not exceptional. Indeed, the quotient $\mathcal{O_K}/\mathfrak{a}$ is always finite, its cardinality is called the norm of the ideal. Further, a finite $\mathbb{Z}$-module, in other words a finite abelian group, does not have any basis as a $\mathbb{Z}$-module, it does not even have an independent subset. 

Thus, its  rank as a $\mathbb{Z}$-module is $0$. 
(Note that there are other notions of rank for finite abelian groups, too.)

One can prove that every finitely generated $\mathbb{Z}$-module is of the form $A \oplus \mathbb{Z}^r$ with $A$ a finite abelian group. Thus for finitely generated modules those with rank $0$ are exactly the finite ones.
Beyond the fact that the zero-module indeed has rank $0$, it is relevant to note that not every module has a basis and thus one needs to be a bit carefull what the rank should be. 

Let us take a basic example with $K$ equal to the rationals, then the ring of integers is just the integers $\mathbb{Z}$. Now for some ideal of the integers, say the one generated by $5$, we have that $5 \mathbb{Z}$ has rank $1$. Yet the quotient $\mathbb{Z}/5\mathbb{Z}$ is not free as a  $\mathbb{Z}$-module and thus has no basis and not even any non-trivial free submodule or independent subset. 

This is not exceptional. Indeed, the quotient $\mathcal{O_K}/\mathfrak{a}$ is always finite, its cardinality is called the norm of the ideal. Further, a finite $\mathbb{Z}$-module, in other words a finite abelian group, does not have any basis as a $\mathbb{Z}$-module, it does not even have an independent subset. 

Thus, its  rank as a $\mathbb{Z}$-module is $0$. 
(Note that there are other notions of rank for finite abelian groups, too.)

One can prove that every finitely generated $\mathbb{Z}$-module is of the form $A \oplus \mathbb{Z}^r$ with $A$ a finite abelian group. Thus for finitely generated modules those with rank $0$ are exactly the finite ones.