apache/dolphinscheduler · error · IllegalArgumentException

bucketName: <bucketName> does not exists, you should create

Error message

bucketName: <bucketName> does not exists, you should create it first

What it means

CosRemoteLogHandler.checkBucketNameExists() calls cosClient.doesBucketExist(bucketName); when the bucket is absent it throws IllegalArgumentException telling you to create the bucket yourself. DolphinScheduler does not auto-create the COS bucket used for remote logs.

Source

Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/remote/CosRemoteLogHandler.java:106

        } catch (Exception e) {
            log.error("error while sending remote log from {} to tencent cos {}, reason:", objectName, logPath, e);
        }
    }

    @Override
    public void close() throws IOException {
        if (cosClient != null) {
            cosClient.shutdown();
        }
    }

    private void checkBucketNameExists(String bucketName) {
        if (StringUtils.isBlank(bucketName)) {
            throw new IllegalArgumentException(Constants.REMOTE_LOGGING_COS_BUCKET_NAME + " is empty");
        }
        boolean existsBucket = cosClient.doesBucketExist(bucketName);
        if (!existsBucket) {
            throw new IllegalArgumentException(
                    "bucketName: " + bucketName + " does not exists, you should create it first");
        }

        log.debug("tencent cos bucket {} has been found for remote logging", bucketName);
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Create the bucket in Tencent COS console (or via cosclient.createBucket) matching remote.logging.cos.bucket.name.
  2. Verify remote.logging.cos.region/endpoint matches the region where the bucket actually exists — region mismatch makes doesBucketExist return false.
  3. Check the bucket name spelling and that your SecretId/SecretKey have permission to query the bucket.

Example fix

// before
remote.logging.cos.bucket.name=nonexistent-bucket

// after
// create in the same region as remote.logging.cos.region
remote.logging.cos.bucket.name=dolphinscheduler-logs-1250000000
Defensive patterns

Strategy: validation

Validate before calling

String bucket = config.getRemoteLoggingCosBucketName();
if (bucket != null && !cosClient.doesBucketExist(bucket)) {
    throw new IllegalStateException("COS bucket " + bucket + " does not exist in region " + config.getRemoteLoggingCosRegion());
}

Try / catch

try {
    initCosRemoteLogHandler();
} catch (IllegalArgumentException e) {
    log.error("COS bucket check failed: {} — create the bucket or fix region/credentials", e.getMessage());
}

Prevention

When it happens

Trigger: Remote logging to COS enabled with a bucket name that does not exist in the configured region/account, checked during handler initialization.

Common situations: Typo in bucket name; bucket exists in a different region than the COS client's endpoint/region config; bucket deleted or access denied so doesBucketExist returns false.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/815fc9b35cb1f2ab. Report an issue: GitHub.