Help with Unique constraint failed

I am getting Unique constraint failed. Below is the log. Appreciate any help. Thanks.

code = Constraint (19), message = System.Data.SQLite.SQLiteException (0x800027AF): constraint failed
UNIQUE constraint failed: FilesetEntry.FilesetID, FilesetEntry.FileID
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
at Duplicati.Library.Main.Database.ExtensionMethods.ExecuteNonQuery(IDbCommand self, Boolean writeLog, String cmd, Object values)
at Duplicati.Library.Main.Database.LocalBackupDatabase.AddFile(Int64 pathprefixid, String filename, DateTime lastmodified, Int64 blocksetID, Int64 metadataID, IDbTransaction transaction)
at Duplicati.Library.Main.Database.LocalBackupDatabase.AddFile(String filename, DateTime lastmodified, Int64 blocksetID, Int64 metadataID, IDbTransaction transaction)
at Duplicati.Library.Main.Operation.Backup.BackupDatabase.<>c__DisplayClass8_0.b__0()
at Duplicati.Library.Main.Operation.Common.SingleRunner.<>c__DisplayClass3_0.b__0()
at Duplicati.Library.Main.Operation.Common.SingleRunner.d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Duplicati.Library.Main.Operation.Backup.MetadataPreProcess.<AddFolderToOutputAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Duplicati.Library.Main.Operation.Backup.MetadataPreProcess.<ProcessMetadata>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Duplicati.Library.Main.Operation.Backup.MetadataPreProcess.<>c__DisplayClass2_0.<<Run>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at CoCoL.AutomationExtensions.<RunTask>d__101.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Duplicati.Library.Main.Operation.BackupHandler.d__13.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Duplicati.Library.Main.Operation.BackupHandler.d__20.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at CoCoL.ChannelExtensions.WaitForTaskOrThrow(Task task)
at Duplicati.Library.Main.Controller.<>c__DisplayClass14_0.b__0(BackupResults result)
at Duplicati.Library.Main.Controller.RunAction[T](T result, String& paths, IFilter& filter, Action`1 method)
at Duplicati.Library.Main.Controller.Backup(String inputsources, IFilter filter)
at Duplicati.Server.Runner.Run(IRunnerData data, Boolean fromQueue)

Hello and welcome @vbanaiah,

We’re going to need a bit more information on your setup to help you out.

  1. Has this job run before and if so how long has it been working for?
  2. What kind of backup job is it? Local folder, FTP, S3, etc…
  3. What operating system are you using?
  4. Have you done a database restore or a DB repair recently?

I’m not much of a DB guy but I do know that unique records should be, well you know, unique. The error itself just indicates that whatever is currently being added, already exists so it can’t save it. Why it’s trying to add a duplicate vs updating the existing record is what we need to figure out.

Any extra details about the setup are helpful, let me know what you can and we’ll see if we can’t get it figured for you.

Agreed. Needs context. Also, what Duplicati version? You can see that on Duplicati’s About screen.
This used to be possible to get on Windows (due to some quirks) if folders end with a space or dot.
Current versions are supposed to be fixed though, so it might be something else we need to chase.

Sorry. Here is more information -
Version is 2.0.6.3
The job runs but always has had that error
It is a backup of a NAS from a Windows 10 machine
Have not done a database restore or repair
I have seen about the trailing dot or space, but I don’t understand how to find those files/folders and fix it
Thanks

I had thought this sort of error would cause the backup to fail. Are you saying it completes anyway?
If you actually have completed some backups, then we would want to be careful while chasing this.

Have you tried reducing the amount that you back up, in order to see if certain data is causing this?
This is easiest and safest to test out if backups are not completing now. Cut back until it completes.

UNIQUE constraint failed: FilesetEntry.FilesetID, FilesetEntry.FileID

means that Duplicati has come across the same file path twice in a backup, and is trying to store it.

presumably connected by SMB, and typically to Linux-like OS. I wonder if any links are doing a loop?

You can see what paths Duplicati is seeing using a Verbose level log file, maybe best written to a file.
log-file=<path> and log-file-log-level=verbose will get enough, then you can check paths around error attempting to see if anything seen then was seen earlier in log file. If so, then we need to look into it…

Alternatively, if you find a loop, you can try skipping the folder that caused it (reduction test as above).

Thank you ts678.
I did a test restore of some important files and it is all there. So, I am assuming except for the ‘bad’ files it is backing everything else.

I will try the verbose log

If your home page, job log, and restore version selector all show the date of the error, then maybe it’s OK, although I would find it surprising. If Duplicati actually errors out early, it doesn’t usually make above items.

Thanks. That might shed more light on the error, and the end of the log will also be a clue as to finish state.