{"record":{"id":"453d2cdae7c24151","repo":"pentaho/pentaho-kettle","slug":"sftpput-error-cannotfindremotefolder","errorCode":null,"errorMessage":"SFTPPut.Error.CanNotFindRemoteFolder","messagePattern":"SFTPPut\\.Error\\.CanNotFindRemoteFolder","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java","lineNumber":388,"sourceCode":"            resultFile.setComment( BaseMessages.getString( PKG, \"SFTPPut.Log.FilenameAddedToResultFilenames\" ) );\n            addResultFile( resultFile );\n            if ( isDetailed() ) {\n              logDetailed( BaseMessages.getString( PKG, \"SFTPPut.Log.FilenameAddedToResultFilenames\", sourceData ) );\n            }\n          }\n          break;\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    }\n  }\n\n  protected void setSFTPDirectory( String spoolDirectory ) throws KettleException {\n\n    boolean existfolder = data.sftpclient.folderExists( spoolDirectory );\n    if ( !existfolder ) {\n      if ( !meta.isCreateRemoteFolder() ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"SFTPPut.Error.CanNotFindRemoteFolder\", spoolDirectory ) );\n      }\n      if ( isDetailed() ) {\n        logDetailed( BaseMessages.getString( PKG, \"SFTPPut.Error.CanNotFindRemoteFolder\", spoolDirectory ) );\n      }\n\n      // Let's create folder\n      data.sftpclient.createFolder( spoolDirectory );\n      if ( isDetailed() ) {\n        logDetailed( BaseMessages.getString( PKG, \"SFTPPut.Log.RemoteFolderCreated\", spoolDirectory ) );\n      }\n    }\n    data.sftpclient.chdir( spoolDirectory );\n\n    if ( isDetailed() ) {\n      logDetailed( BaseMessages.getString( PKG, \"SFTPPut.Log.ChangedDirectory\", spoolDirectory ) );\n    }\n  }","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java#L370-L406","documentation":"Thrown by SFTPPut.setSFTPDirectory when the target remote spool directory does not exist on the SFTP server and the 'Create remote folder' option (isCreateRemoteFolder) is disabled. The step refuses to upload into a non-existent directory rather than implicitly creating it.","triggerScenarios":"folderExists(spoolDirectory) returns false and meta.isCreateRemoteFolder() is false; the path in the step's remote folder setting points to a directory that was deleted, renamed, or never created on the server.","commonSituations":"Typo in the remote path; connecting to a different SFTP account whose home directory lacks the folder; directories cleaned up by a retention job; pointing at a Windows vs Unix path convention mismatch.","solutions":["Enable 'Create remote folder' in the SFTP Put step dialog so the step creates the directory","Create the directory on the SFTP server manually (or via a prior Shell/Job step)","Verify the exact remote path and the login account's home directory — log in with the same credentials and list directories"],"exampleFix":"// before: create remote folder disabled, path may not exist\nmeta.setCreateRemoteFolder( false );\n// after\nmeta.setCreateRemoteFolder( true ); // step will mkdir the spool directory if missing","handlingStrategy":"validation","validationCode":"// before running the transformation, verify the remote dir exists\nSFTPClient client = new SFTPClient( Signals... );\nclient.connect( host, port, user, pass );\nif ( !client.folderExists( remoteSpoolDir ) ) {\n  client.createFolder( remoteSpoolDir ); // or enable 'Create remote folder'\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"CanNotFindRemoteFolder\" ) ) {\n    logError( \"Remote folder \" + remoteSpoolDir + \" missing — enable Create remote folder or mkdir it\" );\n  } else { throw e; }\n}","preventionTips":["Enable 'Create remote folder' for idempotent runs","Verify the remote path with the same login account the step uses","Watch for cleanup jobs that delete the spool directory between runs"],"tags":["sftp","remote-directory","configuration"],"backgroundTag":"directory-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}