paascloud/paascloud-master · warning · OpcBizException

OPC10040011

OPC10040011

Error message

OPC10040011

What it means

OPC10040011 ("今日流量已用尽, 请明天再试") is thrown by OptQiniuOssServiceImpl.checkFileSize when the size of the file being uploaded plus the running total of today's uploads (cached in Redis under a fileSize key, TTL 1 day) exceeds the configured fileMaxSize quota. The OPC module enforces a per-day cumulative upload limit against Qiniu OSS. The exception is an OpcBizException wrapping this error code, raised from uploadFile via checkFileSize.

Solutions

  1. Wait until the Redis quota key expires (1-day TTL) or the next day, then retry the upload.
  2. Increase the configured fileMaxSize for the OPC service to a value appropriate for your workload.
  3. Delete/reset the Redis key holding today's accumulated size (opsForValue().set(fileSizeKey, ...)) if the count is wrong.
  4. Batch or defer uploads so the daily cumulative size stays under fileMaxSize.
  5. If uploads of size > fileMaxSize are legitimate, raise the limit or bypass the check for internal/service accounts.

Example fix

// before: uploads fail once daily total exceeds quota
optQiniuOssService.uploadFile(file);
// after: check remaining quota before uploading
long dailyUsed = Long.parseLong(stringRedisTemplate.opsForValue().get(fileSizeKey) == null ? "0" : stringRedisTemplate.opsForValue().get(fileSizeKey));
if (file.getSize() + dailyUsed > fileMaxSize) {
    throw new OpcBizException(ErrorCodeEnum.OPC10040011);
}
optQiniuOssService.uploadFile(file);
Defensive patterns

Strategy: validation

Validate before calling

String used = redis.opsForValue().get(fileSizeKey);
long dailyUsed = used == null ? 0L : Long.parseLong(used);
if (file.getSize() + dailyUsed > fileMaxSize) {
    throw new IllegalStateException("daily OSS quota would be exceeded");
}

Try / catch

try {
    optQiniuOssService.uploadFile(file);
} catch (OpcBizException e) {
    if ("OPC10040011".equals(e.getMessage()) || e.getCode() == 10040011) {
        throw new QuotaExceededException("Daily upload quota reached; retry tomorrow");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling OptQiniuOssServiceImpl.uploadFile when fileSize + redisFileSize (today's accumulated bytes read from Redis) > fileMaxSize. Also occurs on the first upload of a day if a stale Redis value from the previous day is still within its 1-day TTL, or if fileMaxSize is configured too low.

Common situations: Teams hitting the daily OSS quota during bulk uploads or migration scripts; misconfigured fileMaxSize (e.g. left at a small default); Redis key collision reusing a fileSizeKey from another consumer; clock/timezone mismatch making 'today' appear already consumed.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/fd4e09c6ced00d91. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-opc/src/main/java/com/paascloud/provider/service/impl/OptQiniuOssServiceImpl.java:183

		return auth.uploadToken(bucketName);
	}

	private void checkFileSize(byte[] uploadFileByte) {
		long redisFileSize;
		Long fileMaxSize = paascloudProperties.getQiniu().getOss().getFileMaxSize();
		Preconditions.checkArgument(fileMaxSize != null, "每天上传文件最大值没有配置");

		String fileSizeKey = RedisKeyUtil.getFileSizeKey();
		long fileSize = uploadFileByte.length;

		String redisFileSizeStr = srt.opsForValue().get(fileSizeKey);

		if(StringUtils.isEmpty(redisFileSizeStr)) {
			redisFileSizeStr = "0";
		}
		redisFileSize = Long.valueOf(redisFileSizeStr);
		if (fileSize + redisFileSize > fileMaxSize) {
			throw new OpcBizException(ErrorCodeEnum.OPC10040011);
		}

		srt.opsForValue().set(fileSizeKey, String.valueOf(redisFileSize + fileSize), 1, TimeUnit.DAYS);
	}
}

View on GitHub (pinned to 781281a950)