langgenius/dify · warning

Not Found

Error message

Not Found

What it means

HTTP 404 from the `only_edition_cloud` decorator (controllers/console/wraps.py). Any route wrapped with `@only_edition_cloud` aborts 404 when `dify_config.DEPLOYMENT_EDITION != DeploymentEdition.CLOUD`. Used to restrict routes to the cloud SaaS deployment.

Source

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

    @wraps(view)
    def decorated(*args: Any, **kwargs: Any) -> R:
        # The overloads keep Resource methods method-aware for pyrefly while
        # preserving support for plain functions used in tests and utilities.
        # check account initialization
        current_user, _ = current_account_with_tenant()
        if current_user.status == AccountStatus.UNINITIALIZED:
            raise AccountNotInitializedError()

        return view(*args, **kwargs)

    return decorated


def only_edition_cloud[**P, R](view: Callable[P, R]) -> Callable[P, R]:
    @wraps(view)
    def decorated(*args: P.args, **kwargs: P.kwargs):
        if dify_config.DEPLOYMENT_EDITION != DeploymentEdition.CLOUD:
            abort(404)

        return view(*args, **kwargs)

    return decorated


def only_edition_enterprise[**P, R](view: Callable[P, R]) -> Callable[P, R]:
    @wraps(view)
    def decorated(*args: P.args, **kwargs: P.kwargs):
        if dify_config.DEPLOYMENT_EDITION != DeploymentEdition.ENTERPRISE:
            abort(404)

        return view(*args, **kwargs)

    return decorated


def only_edition_self_hosted[**P, R](view: Callable[P, R]) -> Callable[P, R]:

View on GitHub (pinned to ef8544b173)

Solutions

  1. Set `DEPLOYMENT_EDITION=CLOUD` only if this is genuinely a cloud deployment.
  2. Hide the cloud-only UI affordance on non-cloud deployments (read `/system-features`).
  3. If the feature is needed on-prem, use the equivalent self-hosted route, not the cloud-only one.
  4. Verify the env var spelling and value (`CLOUD` is case-sensitive per the enum).

Example fix

# before
DEPLOYMENT_EDITION=SELF_HOSTED
# after
DEPLOYMENT_EDITION=CLOUD
Defensive patterns

Strategy: validation

Validate before calling

from configs import dify_config
from enums import DeploymentEdition

def is_cloud() -> bool:
    return dify_config.DEPLOYMENT_EDITION == DeploymentEdition.CLOUD

if not is_cloud():
    # do not call cloud-only routes
    ...

Type guard

def is_cloud_edition(v: str | None) -> bool:
    return v == "CLOUD"

Try / catch

try:
    resp = client.get("/cloud-only-route")
except HTTPError as err:
    if err.response.status_code == 404:
        # not cloud — use the equivalent self-hosted route
        ...
    raise

Prevention

When it happens

Trigger: Calling a cloud-only console route from a self-hosted or enterprise deployment.

Common situations: Self-hosted user following cloud-only docs; frontend not hiding cloud-only nav items; mis-set `DEPLOYMENT_EDITION` env var.

Related errors


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