langgenius/dify · error · Forbidden

context_id not found

Error message

context_id not found

What it means

Error "context_id not found" thrown in langgenius/dify.

Source

Thrown at api/controllers/console/datasets/rag_pipeline/datasource_auth.py:216

            "context_id",
            context_id,
            httponly=True,
            samesite="Lax",
            max_age=OAuthProxyService.__MAX_AGE__,
        )
        return response


@console_ns.route("/oauth/plugin/<path:provider_id>/datasource/callback")
class DatasourceOAuthCallback(Resource):
    @console_ns.doc(params=query_params_from_model(DatasourceOAuthCallbackQuery))
    # response-contract:ignore redirect response
    @console_ns.response(302, "Redirect to OAuth callback page")
    @setup_required
    def get(self, provider_id: str):
        context_id = request.cookies.get("context_id") or request.args.get("context_id")
        if not context_id:
            raise Forbidden("context_id not found")

        context = OAuthProxyService.use_proxy_context(context_id)
        if context is None:
            raise Forbidden("Invalid context_id")

        user_id: str = context["user_id"]
        tenant_id: str = context["tenant_id"]
        datasource_provider_id = DatasourceProviderID(provider_id)
        plugin_id = datasource_provider_id.plugin_id
        datasource_provider_service = DatasourceProviderService()
        oauth_client_params = datasource_provider_service.get_oauth_client(
            tenant_id=tenant_id,
            datasource_provider_id=datasource_provider_id,
        )
        if not oauth_client_params:
            raise NotFound()
        redirect_uri = f"{dify_config.CONSOLE_API_URL}/console/api/oauth/plugin/{provider_id}/datasource/callback"
        oauth_handler = OAuthHandler()

View on GitHub (pinned to ef8544b173)

When it happens

Trigger: Thrown at api/controllers/console/datasets/rag_pipeline/datasource_auth.py:216 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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