{"record":{"id":"f27a6efb932e18c7","repo":"pentaho/pentaho-kettle","slug":"file-to-move-arglist-0-can-not-be-found","errorCode":null,"errorMessage":"file to move [ + ArgList[0] + ] can not be found!","messagePattern":"file to move \\[ \\+ ArgList\\[0\\] \\+ \\] can not be found!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":2498,"sourceCode":"          // Destination filename\n          fileDestination = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[1] );\n          if ( fileSource.exists() ) {\n            // Source file exists...\n            if ( fileSource.getType() == FileType.FILE ) {\n              // Great..source is a file ...\n              boolean overwrite = false;\n              if ( !ArgList[1].equals( null ) ) {\n                overwrite = (Boolean) ArgList[2];\n              }\n              boolean destinationExists = fileDestination.exists();\n              // Let's move the file...\n              if ( ( destinationExists && overwrite ) || !destinationExists ) {\n                fileSource.moveTo( fileDestination );\n              }\n\n            }\n          } else {\n            throw new RuntimeException( \"file to move [\" + ArgList[0] + \"] can not be found!\" );\n          }\n        } catch ( IOException e ) {\n          throw new RuntimeException( \"The function call moveFile throw an error : \" + e.toString() );\n        } finally {\n          if ( fileSource != null ) {\n            try {\n              fileSource.close();\n            } catch ( Exception e ) {\n              // Ignore errors\n            }\n          }\n          if ( fileDestination != null ) {\n            try {\n              fileDestination.close();\n            } catch ( Exception e ) {\n              // Ignore errors\n            }\n          }","sourceCodeStart":2480,"sourceCodeEnd":2516,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L2480-L2516","documentation":"moveFile(source, destination, overwrite) is a scripting function that moves a file via KettleVFS. This RuntimeException is thrown when the resolved source FileObject does not exist at move time — the library refuses to proceed rather than silently fail, and the message interpolates the requested source path.","triggerScenarios":"Calling moveFile('/path/missing.txt', '/dest/', ...) where the source file was never created, was already moved, was deleted by another process, or the path string has a typo/wrong protocol prefix.","commonSituations":"Absolute-vs-relative path confusion in the Kettle working directory; file consumed by an earlier step that moved/deleted it; NFS/network shares with transient availability; case-sensitivity mismatch on Linux; missing 'file:///' or 'sftp://' scheme so VFS resolves the wrong location.","solutions":["Verify the source path exists before calling: if (fileExists(src)) moveFile(src, dst, true)","Check for typos, wrong working-directory assumptions, and correct VFS scheme prefix (file:///, sftp://...)","Ensure no earlier transformation step already moved or deleted the source file","Confirm case-sensitive spelling matches the actual filename on the filesystem"],"exampleFix":"// before\nmoveFile(srcPath, dstPath, true);\n// after\nif (fileExists(srcPath)) {\n  moveFile(srcPath, dstPath, true);\n} else {\n  // handle missing source\n}","handlingStrategy":"validation","validationCode":"if (fileExists(srcPath)) {\n  moveFile(srcPath, dstPath, true);\n} else {\n  Logger.logError('Source file missing: ' + srcPath);\n}","typeGuard":"function sourceExists(p) { return p != null && typeof p === 'string' && p.length > 0 && fileExists(p); }","tryCatchPattern":"try {\n  moveFile(src, dst, true);\n} catch (e) {\n  if (String(e.message).indexOf('can not be found') >= 0) {\n    Logger.logError('Source missing: ' + src);\n  } else { throw e; }\n}","preventionTips":["Call fileExists() on the source before moving","Use absolute paths or verify the transformation's working directory","Check earlier steps do not move/delete the same file first","Be careful with case sensitivity on Linux filesystems","Verify VFS scheme prefixes (file:///, sftp://) are correct for the location"],"tags":["javascript","scripting","file-io","vfs"],"backgroundTag":"file-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"}