Failed to load configuration file?

I had a system crash and on the reboot I received this error:
Failed to load the configuration file … duplicacy.json … see the log.

Log says…
Failed to parse the configuration file: invalid character ‘\x00’ looking for beginning of value

And duplicacy.json appears to be empty when I open it with notepad…
Any suggestions on how to recover?

What OS?

If windows, I would run chkdsk c: /f in the elevated prompt to schedule disk check on boot and reboot.

This is unlikely (but possible) to bring the file back but will fix other possible filesystem issues — no reason to assume that it’s the only file that got corrupted.

Then I work delete the file and configure duplicacy from scratch.

Btw, @gchen, Does not duplicacy update the json periodically with e.g. license information (and/or tokens in the future)? Does it do it atomically? Can it be by design interrupted any time without data loss?
This is not the first post where duplicacy.json ends up empty.

Its Windows 10.
Although duplicacy.json appears empty in notepad it is still 17KB.
I’ll run chkdsk…

Yeah, Chkdsk was fine. The crash happened while I was cleanining and formatting a series of USB drives, I blame that. I did have multiple low level programs running like disk part and disk management
At any rate…
what to do about duplicacy.json…
Should I look in my backup for a copy?

When the web GUI updates duplicacy.json, it calls ioutil.WriteFile to write the content to a temporary file and then renames it to replace duplicacy.json

I’m not sure if this was caused ioutil.WriteFile not calling Sync: https://groups.google.com/g/golang-nuts/c/fc3lh8L_5GM

gchen… that was way over my head…

Can you try to open duplicacy.json as a binary file in an editor like notepad++?

Tried notepad++… seesms to be one one line of
[NUL][NUL][NUL][NUL][NUL][NUL]…

tried format-hex:
PS C:\Users\Carl.duplicacy-web> format-hex duplicacy.json

       Path: C:\Users\Carl\.duplicacy-web\duplicacy.json

       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
followed by many more identical lines

Also, log ends with this each time I attempt to run duplicacy:
2022/05/24 19:27:24 Failed to parse the configuration file: invalid character ‘\x00’ looking for beginning of value

I was hoping the content was largely intact other than the leading \x00 but it appears that this file has been completely rewritten, so the only way to do is to remove this file and recreate it from scratch. All previous backups should remain in the storage and are not affected by this.

Bummer. I don’t suppose the duplicacy.json gets backed up by default?

Unfortunately that file isn’t backed up by default.

So I noticed some old files in the .duplicacy-web folder with names like
duplicacy.json.3c540ee7
The most recent is from about 9 months ago… but I hadent made any backup changes. Is there any reason I shouldn’t try and use one of these by renaming it duplicacy.json?
I see some old log dates in the file… any issue just leaving those?
(I’m just trying to avoid trying to do a whole fresh setup.)

Sure. Copy it to .json and if the content is fine it will work. And if it won’t — you don’t lose anything. No reason not to try.

And in the meantime as a quick workaround maybe duplicacy can keep few older versions, until the root cause is being investigated?

Using the old file worked! Thanks saspus! I have an external nas with a couple different volumes that gets backed up by duplicacy on my main computer, so I wasn’t excited about rebuilding the whole config file from scratch (even though I have notes).

1 Like