{"record":{"id":"fd4e09c6ced00d91","repo":"paascloud/paascloud-master","slug":"opc10040011","errorCode":"OPC10040011","errorMessage":"OPC10040011","messagePattern":"OPC10040011","errorType":"error_code","errorClass":"OpcBizException","httpStatus":null,"severity":"warning","filePath":"paascloud-provider/paascloud-provider-opc/src/main/java/com/paascloud/provider/service/impl/OptQiniuOssServiceImpl.java","lineNumber":183,"sourceCode":"\t\treturn auth.uploadToken(bucketName);\n\t}\n\n\tprivate void checkFileSize(byte[] uploadFileByte) {\n\t\tlong redisFileSize;\n\t\tLong fileMaxSize = paascloudProperties.getQiniu().getOss().getFileMaxSize();\n\t\tPreconditions.checkArgument(fileMaxSize != null, \"每天上传文件最大值没有配置\");\n\n\t\tString fileSizeKey = RedisKeyUtil.getFileSizeKey();\n\t\tlong fileSize = uploadFileByte.length;\n\n\t\tString redisFileSizeStr = srt.opsForValue().get(fileSizeKey);\n\n\t\tif(StringUtils.isEmpty(redisFileSizeStr)) {\n\t\t\tredisFileSizeStr = \"0\";\n\t\t}\n\t\tredisFileSize = Long.valueOf(redisFileSizeStr);\n\t\tif (fileSize + redisFileSize > fileMaxSize) {\n\t\t\tthrow new OpcBizException(ErrorCodeEnum.OPC10040011);\n\t\t}\n\n\t\tsrt.opsForValue().set(fileSizeKey, String.valueOf(redisFileSize + fileSize), 1, TimeUnit.DAYS);\n\t}\n}\n","sourceCodeStart":165,"sourceCodeEnd":189,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-opc/src/main/java/com/paascloud/provider/service/impl/OptQiniuOssServiceImpl.java#L165-L189","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Wait until the Redis quota key expires (1-day TTL) or the next day, then retry the upload.","Increase the configured fileMaxSize for the OPC service to a value appropriate for your workload.","Delete/reset the Redis key holding today's accumulated size (opsForValue().set(fileSizeKey, ...)) if the count is wrong.","Batch or defer uploads so the daily cumulative size stays under fileMaxSize.","If uploads of size > fileMaxSize are legitimate, raise the limit or bypass the check for internal/service accounts."],"exampleFix":"// before: uploads fail once daily total exceeds quota\noptQiniuOssService.uploadFile(file);\n// after: check remaining quota before uploading\nlong dailyUsed = Long.parseLong(stringRedisTemplate.opsForValue().get(fileSizeKey) == null ? \"0\" : stringRedisTemplate.opsForValue().get(fileSizeKey));\nif (file.getSize() + dailyUsed > fileMaxSize) {\n    throw new OpcBizException(ErrorCodeEnum.OPC10040011);\n}\noptQiniuOssService.uploadFile(file);","handlingStrategy":"validation","validationCode":"String used = redis.opsForValue().get(fileSizeKey);\nlong dailyUsed = used == null ? 0L : Long.parseLong(used);\nif (file.getSize() + dailyUsed > fileMaxSize) {\n    throw new IllegalStateException(\"daily OSS quota would be exceeded\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    optQiniuOssService.uploadFile(file);\n} catch (OpcBizException e) {\n    if (\"OPC10040011\".equals(e.getMessage()) || e.getCode() == 10040011) {\n        throw new QuotaExceededException(\"Daily upload quota reached; retry tomorrow\");\n    }\n    throw e;\n}","preventionTips":["Check remaining daily quota before each upload batch.","Set fileMaxSize to a value comfortably above real daily needs.","Monitor the Redis quota key and alert before it fills.","Split large migration uploads across days or request a quota increase.","Use unique fileSizeKey names per service to avoid counting others' uploads."],"tags":["quota","redis","oss","upload"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}