duplicati/duplicati · error · UserInformationException
CannotCreateRandomName
CannotCreateRandomName
Error message
Unable to find a unique name for the database, please use --dbpath
What it means
Thrown by CLIDatabaseLocator when auto-creating a new database file: it tries up to 100 randomly generated names and if every candidate path already exists on disk, it gives up and asks the user to supply --dbpath. This is a guard against pathological folder state, not normal operation.
Source
Thrown at Duplicati/Library/Main/CLIDatabaseLocator.cs:219
if (matches.Count == 0)
{
var backupname = options.BackupName;
if (string.IsNullOrEmpty(backupname) || backupname == Options.DefaultBackupName)
backupname = GenerateRandomName();
else
{
foreach (var c in System.IO.Path.GetInvalidFileNameChars())
backupname = backupname.Replace(c.ToString(), "");
}
var newpath = System.IO.Path.Combine(folder, backupname + ".sqlite");
int max_tries = 100;
while (System.IO.File.Exists(newpath) && max_tries-- > 0)
newpath = System.IO.Path.Combine(folder, GenerateRandomName());
if (System.IO.File.Exists(newpath))
throw new Duplicati.Library.Interface.UserInformationException("Unable to find a unique name for the database, please use --dbpath", "CannotCreateRandomName");
//Create a new one, add it to the list, and save it
configs.Add(new BackendEntry()
{
Type = type,
Server = server,
Path = path,
Prefix = prefix,
Username = username,
//Passwordhash = password,
Port = port,
Databasepath = newpath,
ParameterFile = null,
IsSyncDb = isSyncDb
});
var settings = new Newtonsoft.Json.JsonSerializerSettings();
settings.Formatting = Newtonsoft.Json.Formatting.Indented;View on GitHub (pinned to 3f348be3e3)
Solutions
- Supply --dbpath to specify an exact, unused database file path.
- Clean up the target folder: remove orphaned randomly-named .sqlite files.
- Verify write access and free space on the folder.
Example fix
// before: locator cannot find a free random name duplicati backup "s3://host/path" // after: explicit database path duplicati backup "s3://host/path" --dbpath=/data/duplicati/new.sqlite
Defensive patterns
Strategy: validation
Validate before calling
// Avoid relying on random-name collision avoidance
if (string.IsNullOrEmpty(dbPath))
throw new ArgumentException("Supply --dbpath to guarantee a unique database file");
if (System.IO.File.Exists(dbPath)) throw new InvalidOperationException($"{dbPath} already exists"); Try / catch
try { var path = CLIDatabaseLocator.GetDatabasePath(...); }
catch (UserInformationException ex) when (ex.HelpID == "CannotCreateRandomName")
{ /* fall back to an explicit --dbpath chosen by the caller */ } Prevention
- Specify --dbpath explicitly in all deployments.
- Periodically prune orphaned .sqlite files from the database folder.
When it happens
Trigger: autoCreate is true, no existing match is found, and System.IO.File.Exists returns true for all 100 random names generated under the configured folder.
Common situations: The database folder has accumulated hundreds of randomly-named .sqlite files (e.g. from many abandoned backups or a bug leaking files); filesystem/permission issues make File.Exists behave unexpectedly; a very small name space collision (GenerateRandomName collision).
Related errors
- MultipleLocalDatabaseSourcesFound
- Usage: dotnet run <path-to-source-folder> ["copyright name"]
- Start path not found: {startpath}
- KeepWebservicePasswordWithPassword
- InvalidAgentSettingsKey
AI-assisted analysis of duplicati/duplicati@3f348be3e3 (2026-08-13).
Data as JSON: /api/errors/06defcda5dbe564f.
Report an issue: GitHub.