Can't take capital even with casus belli

Solution 1:

You need to take all the surrounding provinces in a previous war, and then you can take the capital. Occupying the provinces is not enough.

Solution 2:

Captial provinces cannot be taken in a normal war unless; it is the opposition's only province ie: the last county, or if it's an isolated exclave, with subsuming this to be the only war-goal.

In war: If a capital is occupied during a war, it will count for a greater warscore because of its value. It also generally cannot be claimed as part of a peace deal unless it is the very last province of the country; as part of an annexation; or if it is isolated and the sole aim of the war.