apache/hadoop · error · IllegalStateException

No user specified for sftp connection. Expand URI or…

Error message

No user specified for sftp connection. Expand URI or credential file.

What it means

SFTPFileSystem.setConfigurationFromURI found no username: neither the URI's userinfo nor a credential-file/conf entry (fs.sftp.user.<host>) supplied the login name, and SFTP requires an explicit user.

Solutions

  1. Include a user in the SFTP URI (sftp://user@host/...) or configure a credential file.
  2. Set the username via the credential file referenced by the configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when an sftp:// URI (and the associated credential file, if any) provides no username for the SFTP connection.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/23aed111a144b62e. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java:129

      : port;
    conf.setInt(FS_SFTP_HOST_PORT, port);

    // get user/password information from URI
    String userAndPwdFromUri = uriInfo.getUserInfo();
    if (userAndPwdFromUri != null) {
      String[] userPasswdInfo = userAndPwdFromUri.split(":");
      String user = userPasswdInfo[0];
      user = URLDecoder.decode(user, "UTF-8");
      conf.set(FS_SFTP_USER_PREFIX + host, user);
      if (userPasswdInfo.length > 1) {
        conf.set(FS_SFTP_PASSWORD_PREFIX + host + "." +
            user, userPasswdInfo[1]);
      }
    }

    String user = conf.get(FS_SFTP_USER_PREFIX + host);
    if (user == null || user.equals("")) {
      throw new IllegalStateException(E_USER_NULL);
    }

    int connectionMax =
        conf.getInt(FS_SFTP_CONNECTION_MAX, DEFAULT_MAX_CONNECTION);
    connectionPool = new SFTPConnectionPool(connectionMax);
  }

  /**
   * Connecting by using configuration parameters.
   *
   * @return An FTPClient instance
   * @throws IOException
   */
  private ChannelSftp connect() throws IOException {
    checkNotClosed();

    Configuration conf = getConf();
    String host = conf.get(FS_SFTP_HOST, null);

View on GitHub (pinned to 2add963021)