{"record":{"id":"6aef8d327f1efe30","repo":"pentaho/pentaho-kettle","slug":"proxy-server-name-must-be-set-and-server-port-must-be","errorCode":null,"errorMessage":"Proxy server name must be set and server port must be greater than zero.","messagePattern":"Proxy server name must be set and server port must be greater than zero\\.","errorType":"validation","errorClass":"KettleJobException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java","lineNumber":434,"sourceCode":"        return false;\n      }\n\n      if ( ( attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS ) == 0 ) {\n        throw new KettleJobException( \"Unknown permissions error\" );\n      }\n\n      retval = attrs.isDir();\n    } catch ( Exception e ) {\n      // Folder can not be found!\n    }\n    return retval;\n  }\n\n  public void setProxy( String host, String port, String user, String pass, String proxyType )\n    throws KettleJobException {\n\n    if ( Utils.isEmpty( host ) || Const.toInt( port, 0 ) == 0 ) {\n      throw new KettleJobException( \"Proxy server name must be set and server port must be greater than zero.\" );\n    }\n    Proxy proxy = null;\n    String proxyhost = host + \":\" + port;\n\n    if ( proxyType.equals( PROXY_TYPE_HTTP ) ) {\n      proxy = new ProxyHTTP( proxyhost );\n      if ( !Utils.isEmpty( user ) ) {\n        ( (ProxyHTTP) proxy ).setUserPasswd( user, pass );\n      }\n    } else if ( proxyType.equals( PROXY_TYPE_SOCKS5 ) ) {\n      proxy = new ProxySOCKS5( proxyhost );\n      if ( !Utils.isEmpty( user ) ) {\n        ( (ProxySOCKS5) proxy ).setUserPasswd( user, pass );\n      }\n    }\n    session.setProxy( proxy );\n  }\n","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java#L416-L452","documentation":"SFTPClient.setProxy validates proxy configuration before building a JSch Proxy. If host is empty or port parses (Const.toInt) to 0, it throws KettleJobException with this message. It is a configuration guard — the proxy was never contacted.","triggerScenarios":"setProxy(host, port, user, pass, proxyType) called with null/empty host, or a port string that is non-numeric/blank/\"0\" so Const.toInt defaults to 0. Called from the SFTP job entry execute() when proxy settings are enabled.","commonSituations":"Proxy port left blank or containing a variable that did not resolve; port typed as 0; hostname field cleared while 'use proxy' checkbox still enabled; environment-specific variables missing at runtime.","solutions":["Set a valid proxy hostname and a numeric port > 0 in the job entry proxy settings","Check that variables used in host/port resolve at runtime (${VAR} left unexpanded is empty/invalid)","Verify proxy type matches the actual proxy (HTTP vs SOCKS5)","Temporarily hardcode host/port to confirm the variable resolution is the culprit"],"exampleFix":"// before\nsftpClient.setProxy(proxyHost, proxyPort, user, pass, PROXY_TYPE_HTTP);\n// after\nif (proxyHost != null && !proxyHost.isEmpty() && Const.toInt(proxyPort, 0) > 0) {\n  sftpClient.setProxy(proxyHost, proxyPort, user, pass, PROXY_TYPE_HTTP);\n} else {\n  throw new KettleJobException(\"Invalid proxy config: host=\" + proxyHost + \" port=\" + proxyPort);\n}","handlingStrategy":"validation","validationCode":"if (Utils.isEmpty(proxyHost) || Const.toInt(proxyPort, 0) <= 0) {\n  throw new KettleJobException(\"Proxy host/port invalid: host=\" + proxyHost + \" port=\" + proxyPort);\n}\nsftpClient.setProxy(proxyHost, proxyPort, proxyUser, proxyPass, proxyType);","typeGuard":null,"tryCatchPattern":"try {\n  sftpClient.setProxy(host, port, user, pass, proxyType);\n} catch (KettleJobException e) {\n  logError(\"Proxy configuration invalid — check host and port variables resolved correctly\", e);\n}","preventionTips":["Never leave host empty or port 0/blank when 'use proxy' is enabled","Verify ${VARIABLES} in proxy fields resolve at runtime (log resolved values)","Validate the port is numeric and > 0 before invoking","Disable the proxy option entirely if no proxy is intended"],"tags":["sftp","proxy","configuration","validation"],"backgroundTag":"missing-required-config-field","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"}