{"record":{"id":"c789d4c0628768fd","repo":"pentaho/pentaho-kettle","slug":"sftpput-error-cannotfindfolder","errorCode":null,"errorMessage":"SFTPPut.Error.CanNotFindFolder","messagePattern":"SFTPPut\\.Error\\.CanNotFindFolder","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java","lineNumber":202,"sourceCode":"        // Destination filename\n        destinationFilename = file.getName().getBaseName();\n      }\n\n      if ( file != null ) {\n        if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) {\n          String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName );\n\n          if ( Utils.isEmpty( realDestationFolder ) ) {\n            // Move to destination folder is empty\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"SFTPPut.Error.MoveToDestinationFolderIsEmpty\" ) );\n          }\n\n          destinationFolder = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( realDestationFolder );\n\n          if ( !destinationFolder.exists() ) {\n            // We can not find folder\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"SFTPPut.Error.CanNotFindFolder\", realDestationFolder ) );\n          }\n        }\n      }\n\n      // move to spool dir ...\n      setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) );\n\n      // Upload a stream\n      data.sftpclient.put( inputStream, destinationFilename );\n\n      if ( file != null ) {\n        // We successfully uploaded the file\n        // what's next ...\n        finishTheJob( file, sourceData, destinationFolder );\n      }\n\n      putRow( getInputRowMeta(), r ); // copy row to possible alternate rowset(s).","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java#L184-L220","documentation":"Thrown when the move-to destination folder (after-FTP move action) does not exist. The step resolves the folder via KettleVFS and calls exists(); if false it aborts with KettleStepException including the folder path. The step does not create missing destination folders.","triggerScenarios":"After-FTP action is MOVE, the folder string from the row is non-empty, but KettleVFS destinationFolder.exists() returns false (typo, missing directory, wrong protocol/URI, or unreachable network share).","commonSituations":"Typo in the archive folder path; directory not pre-created on a new environment; VFS URI scheme mismatch (e.g. sftp:// vs file://); relative path resolving against an unexpected base directory; mounted drive unavailable.","solutions":["Create the destination folder before running the transformation, or add a step that creates it.","Correct the folder path in the row data or configuration; use environment-substituted absolute paths.","Verify the VFS URI/scheme and credentials for remote folders.","Add an upstream existence check or 'Create a folder' step for robustness."],"exampleFix":"// before\nString folder = \"/archive/2026/09\"; // never created\n// after (upstream step or script)\nFiles.createDirectories(Paths.get(\"/archive/2026/09\"));","handlingStrategy":"validation","validationCode":"Path dir = Paths.get(environmentSubstitute(moveToFolder));\nif (!Files.isDirectory(dir)) {\n  Files.createDirectories(dir); // or fail fast before the transformation runs\n}","typeGuard":null,"tryCatchPattern":"try {\n  transform.execute();\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"CanNotFindFolder\")) {\n    log.error(\"Create the archive folder or fix the path: \" + extractPath(e.getMessage()));\n  } else { throw e; }\n}","preventionTips":["Pre-create destination folders in deployment scripts.","Use absolute paths with environment variables for cross-environment correctness.","Verify VFS URI scheme and credentials for remote folders.","Add an upstream 'Create a folder' step."],"tags":["kettle","pentaho","sftp","directory-not-found","vfs"],"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"}