Getting error for "file exists" command of FTP - Qualifier too long. Use MVS naming conventions

Copilot says

The error you’re encountering suggests that the dataset name FIWTPS.UPLOAD./JERECS does not conform to the MVS (Multiple Virtual Storage) dataset naming conventions. This is a common issue when working with FTP servers that require specific naming formats.

Here are some steps you can take to resolve this:

  1. Check Dataset Naming Conventions: Ensure that the dataset name follows MVS naming rules. For example:
  • Names should not contain special characters like /.
  • They should be in the format QUALIFIER.QUALIFIER.QUALIFIER, where each qualifier is 1-8 characters long.
  1. Modify the Remote Path: Update the remotePath parameter in your code to use a valid dataset name. For instance:

csharp

string remotePath = "FIWTPS.UPLOAD.JERECS";
  1. Debugging with FluentFTP:
  • Enable detailed logging in FluentFTP to get more insights into the issue:

csharp

FluentFTP.FtpTrace.EnableTracing = true;
FluentFTP.FtpTrace.LogToConsole = true;
  • This will help you identify if there are other underlying issues.
  1. Consult FTP Server Documentation: If you’re unsure about the naming conventions, refer to the documentation or contact the server administrator for guidance.

I am getting this error now:
System.ArgumentNullException: Value cannot be null. (Parameter ‘path’)
at UiPath.FTP.FtpSession.UiPath.FTP.IFtpSession.DirectoryExistsAsync(String path, CancellationToken cancellationToken)
at UiPath.FTP.Activities.UploadFiles.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)

I have the parameters as below

Local path as “c:\temp\JERECS”

Remote Path as “FIWTPS.UPLOAD.JERECS”

Do I have change anything in FTP scope?

Can you try creating a Sample.txt file on "c:\temp\JERECS" location and specify it as "c:\temp\JERECS\Sample.txt" for str_FilePath.

Are you having the same error?

Yes, it gives same error, Marian.

The backend code for Upload Files can be found at Community.Activities/Activities/FTP/UiPath.FTP.Activities/UploadFiles.cs at develop · UiPath/Community.Activities · GitHub

The error “System.ArgumentNullException: Value cannot be null. (Parameter ‘path’)” suggests that one of the paths being passed to the DirectoryExistsAsync method in the FTP session is null. This issue usually occurs if the LocalPath or RemotePath arguments were not correctly provided or are being resolved to null.

Here’s a checklist to help debug and resolve this issue:

  1. Validate LocalPath and RemotePath :
  • Ensure that both LocalPath (c:\temp\JERECS) and RemotePath (FIWTPS.UPLOAD.JERECS) are not null or empty.
  • Double-check that they’re correctly set and accessible at runtime. Use debugging to print these paths and verify their values.
  1. Check Directory.Exists :
  • Verify that the directory specified in LocalPath (c:\temp\JERECS) exists on your local filesystem. If it doesn’t, ensure the path is accurate and the directory exists.
  1. Ensure the Correct Remote Path:
  • RemotePath should also match the required format for the FTP server. It appears FIWTPS.UPLOAD.JERECS is being treated as a file rather than a directory. You might need to adjust this path depending on whether it’s supposed to point to a file or folder.
  1. Investigate the FTP Session ( ftpSession ):
  • Check whether the ftpSession object is properly initialized and has an active FTP connection. If the FTP session is not set up correctly, the DirectoryExistsAsync call will fail.
  1. Check Null Handling in DirectoryExistsAsync :
  • If either Directory.Exists(localPath) or DirectoryExistsAsync(remotePath) is passed a null value, this error will occur. Add logging or debugging to confirm all parameters being passed are valid.

Additional Recommendations:

  • If Create is false and the directory doesn’t exist, an exception will be thrown. To handle this gracefully, ensure that directories are created when necessary.
  • Ensure no extraneous characters (e.g., trailing slashes or whitespace) are present in the LocalPath and RemotePath values.

Thank you, @marian.platonov for continuous support. I will check the above the resources and make changes to the workflow.