"com.android.phone has stopped" after dirty flashing CM13 After dirty flashing my OnePlus One (bacon) from CM12.1 to CM13, I am constantly getting force close dialogs popup

Unfortunately the process com.android.phone has stopped


Logcat is filled with stacktraces like this:

Shutting down VM
FATAL EXCEPTION: main
Process: com.android.phone, PID: 13148
java.lang.RuntimeException: Unable to get provider com.android.providers.telephony.TelephonyProvider: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
    at android.app.ActivityThread.installProvider(ActivityThread.java:5205)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4797)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4737)
    at android.app.ActivityThread.-wrap1(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5466)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
    at android.database.CursorWindow.nativeGetString(Native Method)
    at android.database.CursorWindow.getString(CursorWindow.java:438)
    at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
    at com.android.providers.telephony.TelephonyProvider$DatabaseHelper.getStringValueFromCursor(TelephonyProvider.java:993)
    at com.android.providers.telephony.TelephonyProvider$DatabaseHelper.copyPreservedApnsToNewTable(TelephonyProvider.java:905)
    at com.android.providers.telephony.TelephonyProvider$DatabaseHelper.onUpgrade(TelephonyProvider.java:641)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256)
    at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187)
    at com.android.providers.telephony.TelephonyProvider.onCreate(TelephonyProvider.java:1457)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
    at android.app.ActivityThread.installProvider(ActivityThread.java:5202)
    ... 10 more


Once I somehow get rid of the persistent UI popup, it seems like com.android.phone is crashing at least 10 times per second, flooding logcat, and making it almost impossible to use the phone.

Is there any hope for a fix, or is a hard reset the only option?
This was because of a change in the code.

As Firelord has said, clear the data for the apps, This can be done like so (this will also delete your SMS/MMS database, so make sure to backup them beforehand):

adb shell
rm -fr /data/data/com.android.providers.telephony/
rm -fr /data/data/com.android.phone/
exit


The -f flag is for force and -r flag means recursive.