{"record":{"id":"7d45cb2bd01b3206","repo":"bytedance/deer-flow","slug":"registration-disabled","errorCode":"registration_disabled","errorMessage":"Self-registration is disabled on this deployment","messagePattern":"Self-registration is disabled on this deployment","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"warning","filePath":"backend/app/gateway/routers/auth.py","lineNumber":353,"sourceCode":"    from deerflow.config.app_config import get_app_config\n\n    try:\n        return get_app_config().auth.local.allow_registration\n    except FileNotFoundError:\n        return True\n\n\n@router.post(\"/register\", response_model=UserResponse, status_code=status.HTTP_201_CREATED)\nasync def register(request: Request, response: Response, body: RegisterRequest):\n    \"\"\"Register a new user account (always 'user' role).\n\n    The first admin is created explicitly through /initialize. This endpoint creates regular users.\n    Auto-login by setting the session cookie.\n\n    Returns 403 when ``auth.local.allow_registration`` is false.\n    \"\"\"\n    if not _local_registration_enabled():\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=AuthErrorResponse(code=AuthErrorCode.REGISTRATION_DISABLED, message=\"Self-registration is disabled on this deployment\").model_dump(),\n        )\n\n    try:\n        user = await get_local_provider().create_user(email=body.email, password=body.password, system_role=\"user\")\n    except ValueError:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=AuthErrorResponse(code=AuthErrorCode.EMAIL_ALREADY_EXISTS, message=\"Email already registered\").model_dump(),\n        )\n\n    token = create_access_token(str(user.id), token_version=user.token_version)\n    _set_session_cookie(response, token, request, remember_me=body.remember_me)\n\n    return UserResponse(id=str(user.id), email=user.email, system_role=user.system_role, oauth_provider=user.oauth_provider)\n\n","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/auth.py#L335-L371","documentation":"403 from POST /api/auth/register: the deployment sets auth.local.allow_registration to false, so self-service account creation is closed. Only the first admin (via /initialize) and admin-managed user creation remain. The body carries code 'registration_disabled'.","triggerScenarios":"POST /api/auth/register on any deployment where config.yaml's auth.local.allow_registration is false or omitted-but-defaulted-off; hitting the sign-up page of a closed instance.","commonSituations":"Single-tenant or internal deployments that disable open signup; the frontend still routing users to a register page after the flag was flipped; config reload after which the flag took effect.","solutions":["Set auth.local.allow_registration: true in config.yaml (then restart/reload the Gateway) if self-registration should be allowed","Otherwise create accounts through an admin or use /initialize for the first admin","Hide the registration UI when the flag is off (the frontend can expose this via config endpoint if available)"],"exampleFix":"# config.yaml — before\nauth:\n  local:\n    allow_registration: false\n\n# after\nauth:\n  local:\n    allow_registration: true","handlingStrategy":"validation","validationCode":"const cfg = await getPublicConfig();\nif (!cfg.auth?.local?.allow_registration) hideSignup();","typeGuard":null,"tryCatchPattern":"try { await register(...); } catch (e) { if (e.status === 403 && e.body?.code === 'registration_disabled') { showMessage('Signup closed on this server'); return; } throw e; }","preventionTips":["Gate the signup UI on the deployment's registration flag","Treat 403 REGISTRATION_DISABLED as a terminal configuration state, not a transient error"],"tags":["auth","http-403","registration","config"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}