Encountered 409 Conflict error after switching from Box access via WebDAV to Box native backend (RESOLVED)

I have stored backups on Box without processing errors since Duplicati v1 using WebDAV. Though Box officially stopped supporting WebDAV since October 2019, it continued to work… until mid august 2022. Looks like Box has finally pulled support for WebDAV as they’re now returning 502 Bad Gateway error

No problem, just switch to the native Box backend! Just another 5 minute job… or not!!

I modified the existing Duplicati backup task by changing the “Storage Type” from “WebDAV” to “Box.com”, and generated the required AuthID here

Should work. Right? Nope! Failed after doing usual processing and uploading, with following error:
[Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Put - Started: duplicati-verification.json (267.40 KB)

[Retry-Duplicati.Library.Main.BackendManager-RetryPut]: Operation Put with file duplicati-verification.json attempt 1 of 5 failed with message: One or more errors occurred. (The remote server returned an error: (409) Conflict.)

NOTE: I have Duplicati config option upload-verification-file enabled

After a good bit of web research, I discovered the likely cause: Apparently the Box (v1) interface - WebDAV, permitted file renaming, but Box (v2) OAuth DOES NOT!!

Confirmation: I manually deleted the remote duplicati-verification.json file using the Box web interface, and the backup ran without error

Challenge: How to automate the deletion of duplicati-verification.json when the backup task is initiated.

Solution: I created a shell script, and called it using the Duplicati config run-script-before parameter. (See details below)

Problem solved! Hope this saves others some head scratching and hair pulling lol

NOTES:

The file delete shell script: (This is obviously for Linux, but same principle applies to Windoze)

Create shell script in /usr/lib/duplicati
eg /usr/lib/duplicati/duplicati_delete_agent.sh

#!/bin/bash

/usr/lib/duplicati/Duplicati.CommandLine.BackendTool.exe DELETE “box://BACKUP/HOSTNAME?authid=” duplicati-verification.json
retVal=“$?”

if [ “$retVal” -ne 0 ]
then
# Writing to stderr causes message to appear in Dupicati session log
echo -e “DELETE_AGENT: WARNING - Failed to delete verification file! (retVal: $retVal)” >&2
fi
#_end script

Call from Duplicati config file via run-script-before /usr/lib/duplicati/duplicati_delete_agent.sh (or whatever)

Script notes:

  • Apparently, options cannot be passed to script by Duplicati! So I was forced to place the AuthID in the script, instead of passing as an arg to the called script as planned :frowning:

  • Set suitable permissions (based on your own setup) on duplicati_agent.sh to protect the AuthID in the script from prying eyes

  • echo “message” >&2 so message shows in Duplicati session log

NOTE: When a NEW Duplicati job is created, the delete script WILL report a warning on first run, as the duplicati-verification.json does not exist initially! I could not find an efficient way to test explicitly for the existence of duplicati-verification.json on the remote side. Duplicati.CommandLine.BackendTool.exe LIST lists ALL files at the destination, not a specific named file. Yes, I could have grepped the file name, but it seemed so inefficient to have the complete backend file list processed each run, just to avoid an error on the first run.

Associated issue when switching from WebDav: Resolving error “The supplied option --auth-username is not supported and will be ignored” - see this post

Welcome to the forum @leadingedge

Duplicati never renames files, and it rarely overwrites, but duplicati-verification.json is one overwrite.
I think Make File backend truncate existing files when overwriting. was a fix for an issue with the file.
If you want to test overwrites, Duplicati.CommandLine.BackendTool can do them. Maybe Box can’t?

You might be able to get it from the DUPLICATI__REMOTEURL variable, or maybe it’s in a different one.

Are any JavaScript developers out there willing to look into this? Duplicati very much needs volunteers.