ArgumentOutOfRangeException: length ('-1')

Hi,

after upgrading to the latest version 2.2.0.0, I changed my backup destination to smb. I can reach the destination after click on “Test Destionation”, but when I try to start the backup, I always get the following error message:

{ "DeletedFiles": 0, "DeletedFolders": 0, "ModifiedFiles": 0, "ExaminedFiles": 0, "OpenedFiles": 0, "AddedFiles": 0, "SizeOfModifiedFiles": 0, "SizeOfAddedFiles": 0, "SizeOfExaminedFiles": 0, "SizeOfOpenedFiles": 0, "NotProcessedFiles": 0, "AddedFolders": 0, "TooLargeFiles": 0, "FilesWithError": 0, "TimestampChangedFiles": 0, "ModifiedFolders": 0, "ModifiedSymlinks": 0, "AddedSymlinks": 0, "DeletedSymlinks": 0, "PartialBackup": false, "Dryrun": false, "MainOperation": "Backup", "CompactResults": null, "VacuumResults": null, "DeleteResults": null, "RepairResults": null, "TestResults": null, "ParsedResult": "Fatal", "Interrupted": false, "Version": "2.2.0.0 (2.2.0.0_stable_2025-10-23)", "EndTime": "2025-10-25T05:35:35.3961407Z", "BeginTime": "2025-10-25T05:35:35.2890452Z", "Duration": "00:00:00.1070955", "MessagesActualLength": 3, "WarningsActualLength": 0, "ErrorsActualLength": 2, "Messages": [ "2025-10-25 07:35:35 +02 - [Information-Duplicati.Library.Main.Controller-StartingOperation]: The operation Backup has started", "2025-10-25 07:35:35 +02 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Started: ()", "2025-10-25 07:35:35 +02 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Completed: (2 bytes)" ], "Warnings": [], "Errors": [ "2025-10-25 07:35:35 +02 - [Error-Duplicati.Library.Main.Operation.BackupHandler-FatalError]: Fatal error\nArgumentOutOfRangeException: length ('-1') must be a non-negative value. (Parameter 'length')\nActual value was -1.", "2025-10-25 07:35:35 +02 - [Error-Duplicati.Library.Main.Controller-FailedOperation]: The operation Backup has failed\nArgumentOutOfRangeException: length ('-1') must be a non-negative value. (Parameter 'length')\nActual value was -1." ], "BackendStatistics": { "RemoteCalls": 1, "BytesUploaded": 0, "BytesDownloaded": 0, "FilesUploaded": 0, "FilesDownloaded": 0, "FilesDeleted": 0, "FoldersCreated": 0, "RetryAttempts": 0, "UnknownFileSize": 0, "UnknownFileCount": 2, "KnownFileCount": 0, "KnownFileSize": 0, "KnownFilesets": 0, "LastBackupDate": "0001-01-01T00:00:00", "BackupListCount": 0, "TotalQuotaSpace": 0, "FreeQuotaSpace": 0, "AssignedQuotaSpace": -1, "ReportedQuotaError": false, "ReportedQuotaWarning": false, "MainOperation": "Backup", "ParsedResult": "Success", "Interrupted": false, "Version": "2.2.0.0 (2.2.0.0_stable_2025-10-23)", "EndTime": "0001-01-01T00:00:00", "BeginTime": "2025-10-25T05:35:35.2890467Z", "Duration": "00:00:00", "MessagesActualLength": 0, "WarningsActualLength": 0, "ErrorsActualLength": 0, "Messages": null, "Warnings": null, "Errors": null } }

Any ideas what’s the reason for that?

Okay, it seems, that Duplicati has no access to the source folder anymore. I’m using “/” as source and I’ve configured a lot of filters to exclude what I don’t need.

Any ideas, what I can do? Everthing works fine, befor upgrading to 2.2.0.0.

I’m using Endeavour OS with KDE.

Welcome to the forum @redskyer

Old or new UI? Filters are on Source page. Are filters set from memory or from the tree view? Possibly you meant the filters already existed? If you can see tree view, there’s some access.

What is the symptom of “no access”, and is it complete or are you talking about certain areas?

What sort of access is allowed by filesystem permission, including any special security setup? Duplicati gets whatever access is allowed for the user it runs as, so what user is it running as?

About → System info can tell you that, but you can also just use ps or similar process viewer. Guessing is also possible, e.g. is it started manually by a user, or running as systemd service?

For your SMB problem, you might need a developer, who might need a stack trace of the error. Possibly About → Logs → Stored has one that you can click on. If not, try that with the live log.

I originally created the backup job in the old UI, but also in the new. I don’t know how I’ve created the job a year ago, but in the new UI, I’ve added the Path “/” manually, because I can not choose the root folder over the tree view.

It’s not a “no access” problem. Now I think its a problem within Duplicati, because if I choose every folder under the root path, the backup works.

Here some checks and modifications:

#ps waux | grep duplicati
root 1739 51.2 0.9 276214776 623660 ? Ssl 12:58 97:46 /opt/duplicati/duplicati-server --webservice-port=8200

#systemctl edit duplicati.service

### Editing /etc/systemd/system/duplicati.service.d/override.conf

Anything between here and the comment below will become the contents of the drop-in file

[Service]
User=root
Group=root

It’s definitely no SMB problem, because the backup works, as described above.

I just cannot choose the “/” path anymore.

I’m looking above at original post which shows failed backup. Quoting again below:

Please reconcile your SMB situation. Did you stop using SMB? I see no other post about SMB.

So not using Duplicati provided package I guess, because Endeavour is is Arch-based, right?
The AUR developers independently decided a long time ago to not run Duplicati as root, which caused support requests here, which led to people editing unit files to gain the desired access.

I’m no unit file guru, but IIRC systemctl edit is one of the right ways, so you edited before?

And the ps looks like duplicati did get root. I don’t see a start time. Did you restart duplicati?

So symptom so far is in GUI? Old or new? What (if anything) is visible on the tree view it gives?
Since this sounds like it was an existing backup, it “should” have just come up with prior choice, however I’m not sure if there is any additional checking to see if the prior choice is still workable.

The old UI still appears to show specially marked folder icon when access is denied, like this:

image

but I can still choose it by checking its box. This would probably hit problem at backup though.

I have to go more in detail. Technically both variants are using SMB.

  1. What I was using before is to write the backup “local”, but the local location was on a SMB mount.
  2. As I got the described error from above, I decided to use “real” SMB, but nothing changed

Yes, that’s correct.

Yes, I did this about a year ago. Since then I had no trouble.

I really don’t know, if that worked a year ago. But for now, no, I can’t choose the root path by GUI (new and old UI). I have to add the path manually. I think that I’ve also done this a year ago.

For now the only option is, to add any (not really any, but that’s not the point) folder under the root path. If I add the root path directly, I’m getting the error message from above.

I checked this in the old UI and no, it’s not a access problem. That would also mean, that no access is possible, when I add every folder under the root path.

Thanks for your help so far. :slightly_smiling_face:

Still can’t tell which is which. New UI offers:

image

however something that behaves like a local file system works too.

image

is the new Duplicati SMB client (so you don’t need to use OS one).

Are these 1 and 2 respectively? What is this change you mention?

I took that to mean going from working #1 to failing #2 set as below:

Did SMB way #1 work before upgrading to 2.2.0.0? Way #2 didn’t exist.

Either way, this needs a dev (but maybe not SMB client dev) and stack.
Please check your stored log and live log, under “About”, as described.

The picture with the GUI still eludes me, maybe due to lack of picture…

Does the image above show why you can’t choose it (no box to check)?
If not, please describe, post a picture, whatever. Or am I guessing right?

Image I posted above is from 2.0.8.1_beta_2024-05-07. 2.1 and 2.2 as well.
I saw “after upgrading to the latest version”, but actually it’s an old problem?
I don’t know why it was done that way, but maybe a dev can give the history.

That might explain why both SMB types are seeing it – it’s not an SMB issue.
I’ll see if I can get it, meanwhile, please also see if you can get a stack trace.

Live log and a click on error gave this stack trace, which I’ll leave for the developers:


Oct 25, 2025 5:49 PM: Fatal error
System.ArgumentOutOfRangeException: length ('-1') must be a non-negative value. (Parameter 'length')
Actual value was -1.
   at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
   at System.ArgumentOutOfRangeException.ThrowIfNegative[T](T value, String paramName)
   at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Duplicati.Library.Utility.Utility.GuessScheme(String url)
   at Duplicati.Library.Main.Operation.BackupHandler.<>c.<GetSourceProviders>b__10_0(String x)
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`2.GetEnumerator()
   at Duplicati.Library.Main.Operation.BackupHandler.GetSourceProviders(IEnumerable`1 sources, Options options, CancellationToken cancellationToken)
   at Duplicati.Library.Main.Operation.BackupHandler.GetSourceProvider(IEnumerable`1 sources, Options options, CancellationToken cancellationToken)
   at Duplicati.Library.Main.Operation.BackupHandler.RunAsync(String[] sources, IBackendManager backendManager, IFilter filter)
   at Duplicati.Library.Main.Controller.<>c__DisplayClass22_0.<<Backup>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Duplicati.Library.Utility.Utility.Await(Task task)
   at Duplicati.Library.Main.Controller.RunAction[T](T result, String[]& paths, IFilter& filter, Func`3 method)
   at Duplicati.Library.Main.Controller.Backup(String[] inputsources, IFilter filter)
   at Duplicati.Server.Runner.RunInternal(Connection databaseConnection, EventPollNotify eventPollNotify, INotificationUpdateService notificationUpdateService, IProgressStateProviderService progressStateProviderService, IApplicationSettings applicationSettings, IRunnerData data, Boolean fromQueue)
   at Duplicati.Server.Runner.Run(Connection databaseConnection, EventPollNotify eventPollNotify, INotificationUpdateService notificationUpdateService, IProgressStateProviderService progressStateProviderService, IApplicationSettings applicationSettings, IQueuedTask data, Boolean fromQueue)
   at Duplicati.WebserverCore.Services.QueueRunnerService.RunTask(IQueuedTask task)

I didn’t bother with any exclude settings because I hoped it would fail fast, backing up /.
2.2.0.0_stable_2025-10-23

Assuming I tested the same way on 2.1.0.5 Stable (I meant to), failure looks like a regression.
2.1.0.5 was busy backing up /swapfile, so I did a systemctl stop duplicati to end that.
Updated to 2.2.0.0 without changing the job, ran it, and it failed. Seems to confirm regression.

GUI Commandline and Export as Command-line both show the source list as / (as requested).

EDIT 1:

This isn’t any sort of SMB, just backing up to local filesystem.

EDIT 2:

Looking at the new GuessScheme code, handling of -1 from not finding :// looks suspicious.
Also wondering why this isn’t breaking lots. Developer probably has an idea on both questions.

Okay, I read my first post and asked myself what happened. I’ve changed the Backup Destination from

As I noticed, that duplicati gave an error, I thought, that it has to do with that change. But after some more tests, I figured out, that this was not the reason for the errors, because the error came on both variants.

Its 100% not a SMB problem, we can ignore that. It was just my first thought, after I got the error. My mistake.

Correct.

Yes, that is also correct, but my problem is not how to add the root path. I can just not make a backup, when I’ve configured the root path. That was working before 2.2.0.0.

Yes, that’s what I was trying to say. Excuse my language.

Exactly. That is what I was trying to say. Thanks for your patience. :grinning_face: