Scan batch task on Trados API randomly fails with message "The file exists."

Hello, 

I have a typical function to add files to a project. I have a very large catalog of html files that I need to convert, around 70k files. I have set up multiple Python workers for this task and they invoke the C# code with the relevant parameters like source, target lang, output path, input file path. However, this typical code here randomly fails:

private void AddFiles(FileBasedProject project, string sourceFilePath)
{
// AddFiles expects an array of strings
string[] sourceFilePaths = { sourceFilePath };
project.AddFiles(sourceFilePaths);

ProjectFile[] projectFiles = project.GetSourceLanguageFiles();

AutomaticTask scan = project.RunAutomaticTask(projectFiles.GetIds(), AutomaticTaskTemplateIds.Scan);

}

the problem is that the scan object has the message "The file exists.". This Add files function sits here in a typical sequence of calls for Trados automation:

newProject = new FileBasedProject(this.GetProjectInfo(srcLocale, trgLocale, outputpath));
var settings_ = newProject.GetSettings();
var xliffSettings = settings_.GetSettingsGroup("SDL XLIFF 1.0 v 1.0.0.0");
xliffSettings.GetSetting<bool>("ValidateXliff").Value = false;
newProject.UpdateSettings(settings_);

this.AddFiles(newProject, sourceFilePath);

What does this "The file exists." even mean? Can you see where this could come from?

If I shut the process off and then try only a failed task on its own, then it works. Can someone help me on this? I have never encountered this before. I am using Trados 2022.

Parents
  • Hi Stelios,

    We have a similar setup with multiple processes running in parallel to create projects and do analyses. We suddenly faced the same error message, "The file exists."

    In our case, the files that already existed were temp files in C:\Windows\SystemTemp. It seems that temp files follow a naming convention and their names are not unique. When running only 1 process at a time, we didn't experience the issue.

    The problem started suddenly after a Windows and/or .Net update. Several recent from Microsoft updates have changed how Windows handles temp files.

    I recommend that you observe the files in C:\Windows\SystemTemp while the problem is happening. If your problem started suddenly, check which Windows KBs have recently been installed and if any of them relate to the handling of temp files. The only solution we have found was to roll back installation of those KBs. This is of course not a great solution due to security, but also because eventually there is a cumulative KB that includes recent past KBs, and the update gets installed automatically again.

    That's our experience. Of course there might be other situations when this error message appears.

    Kind regards,

    Perry

Reply
  • Hi Stelios,

    We have a similar setup with multiple processes running in parallel to create projects and do analyses. We suddenly faced the same error message, "The file exists."

    In our case, the files that already existed were temp files in C:\Windows\SystemTemp. It seems that temp files follow a naming convention and their names are not unique. When running only 1 process at a time, we didn't experience the issue.

    The problem started suddenly after a Windows and/or .Net update. Several recent from Microsoft updates have changed how Windows handles temp files.

    I recommend that you observe the files in C:\Windows\SystemTemp while the problem is happening. If your problem started suddenly, check which Windows KBs have recently been installed and if any of them relate to the handling of temp files. The only solution we have found was to roll back installation of those KBs. This is of course not a great solution due to security, but also because eventually there is a cumulative KB that includes recent past KBs, and the update gets installed automatically again.

    That's our experience. Of course there might be other situations when this error message appears.

    Kind regards,

    Perry

Children