{"record":{"id":"c23586b6e3323299","repo":"pentaho/pentaho-kettle","slug":"symmetriccrypto-cannotfindfile","errorCode":"SymmetricCrypto.CanNotFindFile","errorMessage":"SymmetricCrypto.CanNotFindFile","messagePattern":"SymmetricCrypto\\.CanNotFindFile","errorType":"exception","errorClass":"CryptoException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java","lineNumber":124,"sourceCode":"      throw new CryptoKeyException( e );\n    }\n  }\n\n  public void setSecretKey( byte[] keyBytes ) throws CryptoKeyException {\n    try {\n      // Convert the raw bytes to a secret key like this\n      this.secretKeySpec = new SecretKeySpec( keyBytes, meta.getAlgorithm() );\n    } catch ( Exception e ) {\n      throw new CryptoKeyException( e );\n    }\n  }\n\n  public void setSecretKeyFromFile( Bowl bowl, String filename ) throws CryptoKeyException {\n    FileObject file = null;\n    try {\n      file = KettleVFS.getInstance( bowl ).getFileObject( filename );\n      if ( !file.exists() ) {\n        throw new CryptoException( BaseMessages.getString( PKG, \"SymmetricCrypto.CanNotFindFile\", file.getName() ) );\n      }\n      byte[] KeyBytes = new byte[(int) file.getContent().getSize()];\n\n      setSecretKey( KeyBytes );\n\n    } catch ( Exception e ) {\n      throw new CryptoKeyException( e );\n    } finally {\n      if ( file != null ) {\n        try {\n          file.close();\n        } catch ( Exception e ) { /* Ignore */\n        }\n      }\n    }\n  }\n\n  public byte[] encrDecryptData( byte[] inpBytes ) throws CryptoException {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java#L106-L142","documentation":"setSecretKeyFromFile throws CryptoKeyException with message 'SymmetricCrypto.CanNotFindFile' when the VFS file object for the given filename does not exist. Note the check throws, but the outer catch also wraps other IO failures; this specific message means the key file path did not resolve to an existing file.","triggerScenarios":"Calling setSecretKeyFromFile(bowl, filename) where filename points to a nonexistent path, a directory, or an unmounted/unreachable VFS location (SFTP/HTTP), causing KettleVFS getFileObject + file.exists() to be false.","commonSituations":"Relative path in the transformation but run from a different working directory; key file deleted or renamed after configuration; SFTP/HTTP VFS credentials not set so file resolution fails; Windows path used on Linux.","solutions":["Verify the key file exists at the exact path (use an absolute path)","Check case sensitivity and platform-specific path separators if moving between OSes","For VFS schemes (sftp/http), confirm connection settings and credentials are configured","Deploy the key file alongside the transformation or use an environment variable for the path"],"exampleFix":"// before\nString file = \"keys/secret.key\"; // relative, wrong cwd\nsymmetricCrypto.setSecretKeyFromFile(bowl, file);\n// after\nString file = System.getenv(\"KEY_PATH\"); // absolute path\nsymmetricCrypto.setSecretKeyFromFile(bowl, file);","handlingStrategy":"validation","validationCode":"java.io.File f = new java.io.File(filename);\nif (!f.isAbsolute() || !f.isFile()) {\n  throw new IllegalArgumentException(\"Key file must be an existing file: \" + filename);\n}","typeGuard":null,"tryCatchPattern":"try { crypto.setSecretKeyFromFile(bowl, filename); } catch (CryptoKeyException e) { log.error(\"Key file problem: \" + e.getMessage(), e); }","preventionTips":["Use absolute paths for key files","Deploy key files with the transformation/job","Verify VFS connection settings for remote schemes"],"tags":["crypto","file-not-found","vfs","key-management"],"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"}