Troubleshooting SFTP Connector - Mule 4

To troubleshoot Anypoint Connector for SFTP (SFTP Connector), become familiar with the information about troubleshooting connectivity, permissions and server-side issues, troubleshooting Mule application issues, and interpreting commonly thrown messages.

Troubleshoot Connectivity, Permissions and Server-Side Issues

Sometimes when attempting to connect to an SFTP server you can experience problems establishing the connection because an SFTP server requires a configured encrypted communication channel. For example, you might need to enable specific encryption cyphers or key exchange algorithms, or indicate the location of certain authorization keys.

To resolve this issue:

  1. Locate the SFTP servers configuration file to review the parameters and settings regarding the connection, encryption methods, timeouts, and so forth. Correct configuration as necessary and customize the environment to suit your needs. For example, if you are using OpenSSH you can access the sshd_config file.

  2. Use the configuration file to increase the logging level on the server side.

Troubleshoot Mule Application Issues

Sometimes you are not sure why the application is failing and you require a better understanding of what is going on in the app’s interaction with the SFTP server.

To resolve this error:

  • Use the configuration file to increase the logging level on the server side.

  • Try to replicate the issue using an SFTP client, for example, Cyberduck or Filezilla. If the issue also occurs with these clients, then it is likely that the issue is not related to the Mule app.

  • Get better and more detailed logs on the Mule app side by enabling verbose logging for SFTP Connector and for the JSCH driver:

    1. Access Anypoint Studio and navigate to the Package Explorer view.

    2. Open your application’s project name.

    3. Open the src/main/resources path folder.

    4. Open the log4j2.xml file inside the folder.

    5. If the following line is already in the log4j2.xml file, uncomment it to enable it; otherwise, add it:

          <AsyncLogger name=“org.mule.extension.sftp” level=“TRACE”/>
          <AsyncLogger name=“com.jcraft.jsch” level=“DEBUG”/>
    6. Add the following argument to your run configuration:

  • Try to minimize or remove unnecessary DataWeave data transformations (you could even use hard coded data) to minimize app’s complexity and determine whether the issue is with the interaction between the app and the SFTP server.

To get further information about enabling verbose logging for SDK components in your Mule application, see the Troubleshooting SDK components documentation.

Understand Common Throws

Here is a list of common throws messages and how to interpret them.


    The specified path is invalid because, for example, it does not exist.

    An attempt was made to create a file at the same location and with the same name as an existing file.
    This happens, for example, when attempting to write a file using the CREATE_NEW write mode to the path of an already existing file.

    An operation made an attempt to access an SFTP server path and perform an action for which the user has not been granted permission.

    An operation made an unsuccessful attempt to acquire a lock over a file.

    The *Write* operation received invalid content to write.

    The connection to the SFTP server was interrupted.

    Authentication against the SFTP server failed due to invalid credentials.

    The attempt to connect to the SFTP server timed out.

    An error occurred while attempting to establish the connection to the indicated SFTP server host and port. Typically, the connection is refused remotely, for example, if no process is listening on the remote address or port.

    Mule cannot determine the IP address of a host.

    The app made too many failed login attempts to a server. This can result from multiple causes, but the most common one is invalid credentials.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub