langgenius/dify · warning

Not Found

Error message

Not Found

What it means

HTTP 404 from `flask_admission.py`'s edition-enforcement wrapper. After stacking the auth decorators, if `editions` is provided and `dify_config.DEPLOYMENT_EDITION` is not in the allowed set, the `enforce_edition` wrapper calls `abort(404)` (default message). It deliberately returns 404 rather than 403 to avoid leaking which edition-only routes exist.

Source

Thrown at api/controllers/console/flask_admission.py:59

                request_id=get_request_id(),
                trace_id=get_trace_id() or request.headers.get("X-Trace-Id"),
            )
            return view(self, request_context, *args, **kwargs)

        admitted: Callable[Concatenate[T, P], R | Response] = inject_request_context
        if require_valid_enterprise_license:
            admitted = enterprise_license_required(admitted)
        admitted = account_initialization_required(admitted)
        admitted = login_required(admitted)
        admitted = setup_required(admitted)

        if editions is None:
            return admitted

        @wraps(view)
        def enforce_edition(self: T, /, *args: P.args, **kwargs: P.kwargs) -> R | Response:
            if dify_config.DEPLOYMENT_EDITION not in editions:
                abort(404)
            return admitted(self, *args, **kwargs)

        return enforce_edition

    return decorator

View on GitHub (pinned to ef8544b173)

Solutions

  1. Confirm `DEPLOYMENT_EDITION` matches the edition the route requires.
  2. Upgrade/license the deployment to the required edition if the route is legitimately needed.
  3. Do not expose edition-gated UI elements on deployments that lack that edition.
  4. Treat the 404 as intentional — the route intentionally does not advertise its existence.

Example fix

# before
DEPLOYMENT_EDITION=SELF_HOSTED  # but route requires ENTERPRISE
# after
DEPLOYMENT_EDITION=ENTERPRISE  # with a valid enterprise license
Defensive patterns

Strategy: validation

Validate before calling

from configs import dify_config

def edition_allowed(allowed: set[str]) -> bool:
    return dify_config.DEPLOYMENT_EDITION in allowed

# before calling an edition-gated route, confirm:
if not edition_allowed({"ENTERPRISE"}):  # or whichever the route requires
    ...

Type guard

ALLOWED_EDITIONS = {"CLOUD", "ENTERPRISE", "SELF_HOSTED", "COMMUNITY"}
def is_known_edition(v: str | None) -> bool:
    return v in ALLOWED_EDITIONS

Try / catch

try:
    resp = client.get("/some-edition-only-route")
except HTTPError as err:
    if err.response.status_code == 404:
        # edition mismatch — route intentionally not advertised
        ...
    raise

Prevention

When it happens

Trigger: Calling any console route decorated with an `editions=[...]` allowlist on a deployment whose `DEPLOYMENT_EDITION` is not in that list.

Common situations: Hitting an enterprise-only or cloud-only endpoint from a community/self-hosted deployment; edition mismatch after a license downgrade; misconfigured `DEPLOYMENT_EDITION` env var.

Related errors


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