langgenius/dify · warning

The annotation quota has reached the limit of your subscript

Error message

The annotation quota has reached the limit of your subscription.

What it means

HTTP 403 from `cloud_edition_billing_resource_check("annotation")`. When `resource == "annotation"` and `0 < annotation_quota_limit.limit < annotation_quota_limit.size` (strictly less than — note the asymmetry vs other quotas), the decorator aborts with `The annotation quota has reached the limit of your subscription.` Blocks new annotation uploads once usage exceeds the limit.

Source

Thrown at api/controllers/console/wraps.py:216

                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,
) -> Callable[[Callable[P, R]], Callable[P, R]]:
    def interceptor(view: Callable[P, R]):
        @wraps(view)
        def decorated(*args: P.args, **kwargs: P.kwargs):
            _, current_tenant_id = current_account_with_tenant()
            features = FeatureService.get_features(current_tenant_id, exclude_vector_space=True)

View on GitHub (pinned to ef8544b173)

Solutions

  1. Upgrade the workspace plan to raise the annotation quota.
  2. Delete old/unused annotations to bring `size` back under `limit`.
  3. Surface `annotation_quota_limit` (`limit`/`size`) in the annotation UI and disable add at the ceiling.
  4. Be aware the check is `limit < size` (strict), so plan for off-by-one vs the members/apps/documents checks.

Example fix

// before
await addAnnotation(payload)  // 403 once size > limit
// after
const { annotation_quota_limit: q } = await getFeatures()
if (q.limit > 0 && q.size >= q.limit) {
  alert('Annotation quota reached — upgrade or remove annotations.')
} else {
  await addAnnotation(payload)
}
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.annotation_quota_limit

# server uses strict limit < size, so block once size >= limit
def can_add_annotation() -> bool:
    return not (q.limit > 0 and q.size >= q.limit)

if not can_add_annotation():
    # surface upgrade prompt instead of adding annotation
    ...

Type guard

def under_annotation_quota(limit: int, size: int) -> bool:
    # note: server check is limit < size (strict); client guard at size >= limit is safe
    return not (limit > 0 and size >= limit)

Try / catch

try:
    resp = client.post("/apps/<app>/annotation-reply", ...)
except HTTPError as err:
    if err.response.status_code == 403 and "annotation" in err.response.text:
        # annotation quota reached — upgrade or remove annotations
        ...
    raise

Prevention

When it happens

Trigger: Adding an annotation on a tenant whose annotation count already exceeds the plan's annotation quota (`size > limit`, with `limit > 0`).

Common situations: Free-plan tenant with a small annotation quota after heavy annotate use; mismatch between UI counter and server count after concurrent annotation adds; note the strict `<` means the cap trips one annotation later than the other resources' `<=`.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/5f3113a5d45f8a15. Report an issue: GitHub.