{"record":{"id":"8983eec91e7af3cb","repo":"Significant-Gravitas/AutoGPT","slug":"chat-sharing-is-not-enabled","errorCode":null,"errorMessage":"Chat sharing is not enabled","messagePattern":"Chat sharing is not enabled","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/chat/share.py","lineNumber":117,"sourceCode":"@owner_router.post(\n    \"/sessions/{session_id}/share\",\n    responses={\n        403: {\"description\": \"Chat sharing is not enabled for this user\"},\n        404: {\"description\": \"Chat session not found for user\"},\n    },\n)\nasync def enable_chat_sharing(\n    session_id: Annotated[str, Path],\n    user_id: Annotated[str, Security(auth.get_user_id)],\n    body: EnableShareRequest = Body(default_factory=EnableShareRequest),\n) -> ShareResponse:\n    \"\"\"Enable sharing for a chat session.\n\n    Flag-gated: refuses with 403 when ``chat-sharing`` is off so a stale\n    frontend cannot enable shares post-rollback.\n    \"\"\"\n    if not await is_feature_enabled(Flag.CHAT_SHARING, user_id):\n        raise HTTPException(status_code=403, detail=\"Chat sharing is not enabled\")\n\n    base_url = settings.config.frontend_base_url\n    if not base_url:\n        # Fail fast rather than handing the user a localhost URL that\n        # only works on the backend host.  This catches deployment\n        # misconfigurations at share-enable time instead of silently\n        # shipping broken share URLs to end users.\n        logger.error(\"frontend_base_url is not configured; refusing to enable share\")\n        raise HTTPException(\n            status_code=500, detail=\"Sharing is not configured on this deployment\"\n        )\n\n    try:\n        share_token = await share_db.enable_chat_session_share(\n            session_id=session_id,\n            user_id=user_id,\n            auto_share_executions=body.auto_share_executions,\n        )","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/chat/share.py#L99-L135","documentation":"HTTP 403 from the share-enable endpoint (backend/api/features/chat/share.py:117). Chat sharing is behind the `chat-sharing` feature flag checked per user via is_feature_enabled(Flag.CHAT_SHARING, user_id). When the flag is off for that user, the endpoint refuses with 403 so a stale frontend cannot enable shares after a rollback (per the docstring).","triggerScenarios":"POST to enable sharing for a session while the CHAT_SHARING flag is disabled globally or for that specific user (flag service decides per user_id).","commonSituations":"Feature rolled back but cached frontend still shows share buttons; gradual rollout where the user isn't in the enabled cohort; local/self-hosted deployment with the flag defaulted off; flag service misconfiguration.","solutions":["Enable the chat-sharing flag for the user (or globally) in the feature-flag service, then retry.","Client-side: gate the share button on the flag state fetched from the flags endpoint rather than hardcoding it.","Treat 403 as permanent policy — do not retry; hide the share UI and possibly prompt a refresh to pick up rolled-back frontend assets."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// check the flag before rendering share controls\nconst flags = await getFeatureFlags();\nif (!flags['chat-sharing']) hideShareButton();","typeGuard":"function chatSharingEnabled(flags: Record<string, boolean>): boolean {\n  return flags['chat-sharing'] === true;\n}","tryCatchPattern":"try { await post(`/chat/sessions/${id}/share/enable`); } catch (e) { if (e.status === 403) { hideShareUI(); return; } throw e; }","preventionTips":["Drive share UI visibility from the feature-flag service, not a hardcoded build flag","On 403, drop the share affordance — it signals rollback/policy, not a transient fault","During gradual rollouts, expect mixed 403s per user and handle them silently"],"tags":["http","feature-flag","sharing","authorization","fastapi"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}