apache/hadoop · critical · IOException

SignVersion is V4 but region is empty

Error message

SignVersion is V4 but region is empty

What it means

Thrown by AliyunOSSFileSystemStore.initialize(): fs.oss.signature.version (SIGNATURE_VERSION_KEY) is set to "V4" (case-insensitive) but fs.oss.region (REGION_KEY) is empty. OSS V4 signing requires the region in the Credential string, so without it the client cannot sign any request; the store logs an error and fails initialization with IOException("SignVersion is V4 but region is empty").

Source

Thrown at hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystemStore.java:123

        SECURE_CONNECTIONS_DEFAULT);
    clientConf.setProtocol(secureConnections ? Protocol.HTTPS : Protocol.HTTP);
    clientConf.setMaxErrorRetry(conf.getInt(MAX_ERROR_RETRIES_KEY,
        MAX_ERROR_RETRIES_DEFAULT));
    clientConf.setConnectionTimeout(conf.getInt(ESTABLISH_TIMEOUT_KEY,
        ESTABLISH_TIMEOUT_DEFAULT));
    clientConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT_KEY,
        SOCKET_TIMEOUT_DEFAULT));
    clientConf.setUserAgent(
        conf.get(USER_AGENT_PREFIX, USER_AGENT_PREFIX_DEFAULT) + ", Hadoop/"
            + VersionInfo.getVersion());

    String region = conf.get(REGION_KEY, "");
    String signatureVersion = conf.get(SIGNATURE_VERSION_KEY, SIGNATURE_VERSION_DEFAULT);
    if ("V4".equalsIgnoreCase(signatureVersion)) {
      clientConf.setSignatureVersion(SignVersion.V4);
      if (StringUtils.isEmpty(region)) {
        LOG.error("Signature version is V4 ,but region is empty.");
        throw new IOException("SignVersion is V4 but region is empty");
      }
    }

    String proxyHost = conf.getTrimmed(PROXY_HOST_KEY, "");
    int proxyPort = conf.getInt(PROXY_PORT_KEY, -1);
    if (StringUtils.isNotEmpty(proxyHost)) {
      clientConf.setProxyHost(proxyHost);
      if (proxyPort >= 0) {
        clientConf.setProxyPort(proxyPort);
      } else {
        if (secureConnections) {
          LOG.warn("Proxy host set without port. Using HTTPS default 443");
          clientConf.setProxyPort(443);
        } else {
          LOG.warn("Proxy host set without port. Using HTTP default 80");
          clientConf.setProxyPort(80);
        }
      }

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.oss.region to the bucket's region (e.g., oss-cn-hangzhou / cn-hangzhou) alongside fs.oss.signature.version=V4
  2. If you cannot supply a region, fall back to the default signature version by removing the fs.oss.signature.version override (verify the bucket still accepts it)
  3. Verify with a minimal ls (hadoop fs -ls oss://bucket/) after the config change to confirm initialization succeeds

Example fix

<!-- before -->
<property><name>fs.oss.signature.version</name><value>V4</value></property>

<!-- after -->
<property><name>fs.oss.signature.version</name><value>V4</value></property>
<property><name>fs.oss.region</name><value>oss-cn-hangzhou</value></property>
Defensive patterns

Strategy: validation

Validate before calling

String sigVer = conf.get("fs.oss.signatureversion", "");
String region = conf.get("fs.oss.region", "");
if ("V4".equalsIgnoreCase(sigVer) && region.isEmpty()) {
  throw new IOException("fs.oss.region is required when fs.oss.signatureversion=V4");
}

Try / catch

catch (IOException e) { if ("SignVersion is V4 but region is empty".equals(e.getMessage())) { /* fix config, not retryable */ throw e; } throw e; }

Prevention

When it happens

Trigger: Setting fs.oss.signature.version=V4 in core-site.xml (or per-job Configuration) without fs.oss.region; upgrading hadoop-aliyun / SDK where V4 becomes the desired default; copying endpoint config from an older setup that never needed a region.

Common situations: Migrations to V4 signing to satisfy newer OSS buckets that reject V1 signatures; region mismatch or omission in multi-region deployments; config templates that predate the region option.

Related errors


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