langgenius/dify · warning
The number of documents has reached the limit of your…
Error message
The number of documents has reached the limit of your subscription.
What it means
HTTP 403 from `cloud_edition_billing_resource_check("documents")`, fired only when the upload `source` is `datasets`. When `resource == "documents"` and `0 < documents_upload_quota.limit <= documents_upload_quota.size`, and `request.args/form.get("source") == "datasets"`, the decorator aborts with `The number of documents has reached the limit of your subscription.` Non-datasets uploads are allowed to pass through.
Solutions
- Upgrade the workspace plan to raise the document quota.
- Delete stale documents to bring `size` under `limit`.
- Surface the quota (`documents_upload_quota`) in the datasets UI and block uploads at the ceiling.
- Always send `source=datasets` from dataset uploads so the quota is enforced consistently.
Example fix
// before
fetch('/files/upload', { body: form }) // omitting source bypasses quota
// after
form.append('source', 'datasets')
fetch('/files/upload', { body: form }) // quota enforced; show upgrade CTA on 403 Defensive patterns
Strategy: validation
Validate before calling
from services.feature_service import FeatureService
_, tenant_id = current_account_with_tenant()
features = FeatureService.get_features(tenant_id, exclude_vector_space=True)
q = features.documents_upload_quota
def can_upload_dataset_doc() -> bool:
return not (q.limit > 0 and q.size >= q.limit)
if not can_upload_dataset_doc():
# surface upgrade prompt instead of uploading to datasets
... Type guard
def under_doc_quota(limit: int, size: int) -> bool:
return not (limit > 0 and size >= limit) Try / catch
try:
# always send source=datasets from dataset uploads
resp = client.post("/files/upload", files=..., data={"source": "datasets"})
except HTTPError as err:
if err.response.status_code == 403 and "documents" in err.response.text:
# document quota reached — upgrade or clean up
...
raise Prevention
- Always send source=datasets from dataset uploads so the quota is enforced consistently.
- Show document quota in the datasets UI; block uploads at the ceiling.
- Delete stale documents to free quota.
- Upgrade the plan to raise the document quota.
When it happens
Trigger: Uploading a document to a dataset (`source=datasets`) on a tenant whose document upload count has reached the plan quota. Uploads without `source=datasets` deliberately bypass this check.
Common situations: Free-plan workspace hitting the documents quota; batch ingest from the datasets UI; the upload API being reused from another flow without the `source=datasets` marker (then it silently bypasses the check).
Related errors
- provider_quota_exceeded
- The annotation quota has reached the limit of your…
- The number of apps has reached the limit of your…
- The number of members has reached the limit of your…
- provider_quota_exceeded
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/3dfc10d20d92c7de.
Report an issue: GitHub.
Appendix: source
Thrown at api/controllers/console/wraps.py:210
)
return view(*args, **kwargs)
features = FeatureService.get_features(current_tenant_id, exclude_vector_space=True)
if features.billing.enabled:
members = features.members
apps = features.apps
documents_upload_quota = features.documents_upload_quota
annotation_quota_limit = features.annotation_quota_limit
if resource == "members" and 0 < members.limit <= members.size:
abort(403, "The number of members has reached the limit of your subscription.")
elif resource == "apps" and 0 < apps.limit <= apps.size:
abort(403, "The number of apps has reached the limit of your subscription.")
elif resource == "documents" and 0 < documents_upload_quota.limit <= documents_upload_quota.size:
# The api of file upload is used in the multiple places,
# so we need to check the source of the request from datasets
source = request.args.get("source") or request.form.get("source")
if source == "datasets":
abort(403, "The number of documents has reached the limit of your subscription.")
else:
return view(*args, **kwargs)
elif resource == "workspace_custom" and not features.can_replace_logo:
abort(403, "The workspace custom feature has reached the limit of your subscription.")
elif resource == "annotation" and 0 < annotation_quota_limit.limit < annotation_quota_limit.size:
abort(403, "The annotation quota has reached the limit of your subscription.")
else:
return view(*args, **kwargs)
return view(*args, **kwargs)
return decorated
return interceptor
def cloud_edition_billing_knowledge_limit_check[**P, R](
resource: str,View on GitHub (pinned to ef8544b173)