HELP! An unexpected error occurred: Malformed masterkey file (App 1.5.13)

Hello, dear Cryptomator Community! Everything was working perfectly, until I opened the app one day and had this:

java.io.IOException: Malformed masterkey file C:\Users\Alexander\Downloads\Private\masterkey.cryptomator
	at org.cryptomator.cryptofs.migration.Migrators.needsMigration(Migrators.java:86)
	at org.cryptomator.common.vaults.VaultListManager.determineVaultState(VaultListManager.java:129)
	at org.cryptomator.common.vaults.VaultListManager.create(VaultListManager.java:97)
	at org.cryptomator.common.vaults.VaultListManager.add(VaultListManager.java:64)
	at org.cryptomator.ui.addvaultwizard.ChooseExistingVaultController.chooseFileAndNext(ChooseExistingVaultController.java:81)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
	at com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1859)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1729)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Node.fireEvent(Node.java:8886)
	at javafx.scene.control.Button.fire(Button.java:203)
	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208)
	at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3856)
	at javafx.scene.Scene.processMouseEvent(Scene.java:1851)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:556)
	at com.sun.glass.ui.View.notifyMouse(View.java:942)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Unable to parse key file.
	at org.cryptomator.cryptolib.api.KeyFile.parse(KeyFile.java:89)
	at org.cryptomator.cryptofs.migration.Migrators.needsMigration(Migrators.java:83)
	... 66 more
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 3 path $
	at com.google.gson.JsonParser.parseReader(JsonParser.java:66)
	at org.cryptomator.cryptolib.api.KeyFile.parse(KeyFile.java:80)
	... 67 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 3 path $
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1564)
	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1405)
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:543)
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:426)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:61)
	... 68 more

Restart didn’t help. Installing app 1.5.10 didn’t help.
Please, help! Thank you!

The masterkey file (MK-file) of the vault (litterally called masterkey.cryptomator) is damaged. Without it, you cannot open the vault, because it contains the masterkey to your vault in an secure/encrypted form.

Cryptomator always creates backups of this file, placed right next it and with the file extension .bkup.

To recover:

  1. Store a copy of your damaged MK-file somewhere, just in case.
  2. Rename the most recent backup file to masterkey.cryptomator
  3. Unlock your vault
1 Like

OMG! Thank you SO MUCH!
You are a life saver!
It helped!
HAVE A WONDERFUL DAY! (^_^)

Hi, I would like to know if this solution applies in my case. I have the files still encrypted and the backup key. I just don’t have the 'd ’ folder that was accidentally deleted. The question is if with the backup key I can unlock my files again by creating a new 'd ’ folder and putting the files in there? Or do I just need to use this backup key in the vault to be able to open the files? I appreciate if you can help. Thank
[Error adding masterkey key to vault - Dokany - #8 by DVDSEC]

No, it does not apply.

© 2021 Skymatic GmbH • Privacy PolicyImpressum