{"record":{"id":"471ab95bc4c3cdf5","repo":"langgenius/dify","slug":"not-found-471ab9","errorCode":null,"errorMessage":"Not Found","messagePattern":"Not Found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"api/controllers/console/wraps.py","lineNumber":134,"sourceCode":"    @wraps(view)\n    def decorated(*args: Any, **kwargs: Any) -> R:\n        # The overloads keep Resource methods method-aware for pyrefly while\n        # preserving support for plain functions used in tests and utilities.\n        # check account initialization\n        current_user, _ = current_account_with_tenant()\n        if current_user.status == AccountStatus.UNINITIALIZED:\n            raise AccountNotInitializedError()\n\n        return view(*args, **kwargs)\n\n    return decorated\n\n\ndef only_edition_cloud[**P, R](view: Callable[P, R]) -> Callable[P, R]:\n    @wraps(view)\n    def decorated(*args: P.args, **kwargs: P.kwargs):\n        if dify_config.DEPLOYMENT_EDITION != DeploymentEdition.CLOUD:\n            abort(404)\n\n        return view(*args, **kwargs)\n\n    return decorated\n\n\ndef only_edition_enterprise[**P, R](view: Callable[P, R]) -> Callable[P, R]:\n    @wraps(view)\n    def decorated(*args: P.args, **kwargs: P.kwargs):\n        if dify_config.DEPLOYMENT_EDITION != DeploymentEdition.ENTERPRISE:\n            abort(404)\n\n        return view(*args, **kwargs)\n\n    return decorated\n\n\ndef only_edition_self_hosted[**P, R](view: Callable[P, R]) -> Callable[P, R]:","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/wraps.py#L116-L152","documentation":"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.","triggerScenarios":"Calling a cloud-only console route from a self-hosted or enterprise deployment.","commonSituations":"Self-hosted user following cloud-only docs; frontend not hiding cloud-only nav items; mis-set `DEPLOYMENT_EDITION` env var.","solutions":["Set `DEPLOYMENT_EDITION=CLOUD` only if this is genuinely a cloud deployment.","Hide the cloud-only UI affordance on non-cloud deployments (read `/system-features`).","If the feature is needed on-prem, use the equivalent self-hosted route, not the cloud-only one.","Verify the env var spelling and value (`CLOUD` is case-sensitive per the enum)."],"exampleFix":"# before\nDEPLOYMENT_EDITION=SELF_HOSTED\n# after\nDEPLOYMENT_EDITION=CLOUD","handlingStrategy":"validation","validationCode":"from configs import dify_config\nfrom enums import DeploymentEdition\n\ndef is_cloud() -> bool:\n    return dify_config.DEPLOYMENT_EDITION == DeploymentEdition.CLOUD\n\nif not is_cloud():\n    # do not call cloud-only routes\n    ...","typeGuard":"def is_cloud_edition(v: str | None) -> bool:\n    return v == \"CLOUD\"","tryCatchPattern":"try:\n    resp = client.get(\"/cloud-only-route\")\nexcept HTTPError as err:\n    if err.response.status_code == 404:\n        # not cloud — use the equivalent self-hosted route\n        ...\n    raise","preventionTips":["Hide cloud-only affordances on non-cloud deployments.","Confirm DEPLOYMENT_EDITION=CLOUD before relying on cloud-only routes.","Use self-hosted equivalents where they exist.","Read /system-features to drive UI gating."],"tags":["edition","cloud-only","http-404","deployment-config"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}