{"record":{"id":"ef074b272b3c9abd","repo":"langflow-ai/langflow","slug":"auth-config-is-missing-please-check-your-settings","errorCode":null,"errorMessage":"Auth config is missing. Please check your settings and try again.","messagePattern":"Auth config is missing\\. Please check your settings and try again\\.","errorType":"validation","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mcp_projects.py","lineNumber":1344,"sourceCode":"\n    Args:\n        project: The project object containing auth_settings\n\n    Returns:\n        dict: The decrypted authentication configuration\n\n    Raises:\n        HTTPException: If MCP Composer is not enabled or auth config is missing\n    \"\"\"\n    auth_config = None\n    if project.auth_settings:\n        decrypted_settings = decrypt_auth_settings(project.auth_settings)\n        if decrypted_settings:\n            auth_config = decrypted_settings\n\n    if not auth_config:\n        error_message = \"Auth config is missing. Please check your settings and try again.\"\n        raise ValueError(error_message)\n\n    return auth_config\n\n\n# Project-specific MCP server instance for handling project-specific tools\nclass ProjectMCPServer:\n    def __init__(self, project_id: UUID):\n        self.project_id = project_id\n        self.server = Server(f\"langflow-mcp-project-{project_id}\")\n        # TODO: implement an environment variable to enable/disable stateless mode\n        self.session_manager = StreamableHTTPSessionManager(self.server, stateless=True)\n        # since we lazily initialize the session manager's lifecycle\n        # via .run(), which can only be called once, otherwise an error is raised,\n        # we use the lock to prevent race conditions on concurrent requests to prevent such an error\n        self._manager_lock = anyio.Lock()\n        self._manager_started = False  # whether or not the session manager is running\n\n        # Register handlers that filter by project","sourceCodeStart":1326,"sourceCodeEnd":1362,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mcp_projects.py#L1326-L1362","documentation":"Raised by _get_mcp_composer_auth_config() in Langflow's MCP projects API when a project has no usable MCP Composer authentication settings. The helper reads project.auth_settings, runs decrypt_auth_settings() over it, and requires a truthy dict result; if auth_settings is null/empty or decrypts to an empty result, the ValueError 'Auth config is missing' is raised before any Composer URL can be built. Callers such as get_composer_sse_url() depend on this config to construct the http://<oauth_host>:<oauth_port>/sse endpoint.","triggerScenarios":"Calling get_composer_sse_url(project) (or any flow that invokes _get_mcp_composer_auth_config) for a Folder/project whose auth_settings column is NULL, an empty dict/string, or holds encrypted content that decrypt_auth_settings cannot decode into a non-empty dict (e.g. encrypted with a different key or corrupted ciphertext).","commonSituations":"MCP Composer was never configured for the project in the UI before requesting its SSE URL; the database was migrated or restored between environments so auth_settings ciphertext is undecryptable with the current secrets key; a race where the project record is read before the user finishes saving Composer credentials; tests using a bare Folder fixture with no auth_settings.","solutions":["Configure MCP Composer auth settings for the project (oauth_host, oauth_port, and credentials) via the project settings endpoint/UI, then retry the Composer SSE URL request.","If settings were saved previously but decrypt to empty, verify the encryption key/secret used by decrypt_auth_settings matches the environment that originally encrypted project.auth_settings (check for changed LANGFLOW secret env vars after a redeploy).","Re-enter and re-save the Composer credentials so they are re-encrypted with the current key, overwriting stale auth_settings.","For tests, construct the project fixture with valid auth_settings (or mock _get_mcp_composer_auth_config) so the Composer path has credentials to read."],"exampleFix":"# before: called on a project that may have no Composer config\nsse_url = await get_composer_sse_url(project)  # ValueError: Auth config is missing\n\n# after: validate first and surface a 4xx to the caller\nsettings = decrypt_auth_settings(project.auth_settings) if project.auth_settings else None\nif not settings or not (settings.get(\"oauth_host\") and settings.get(\"oauth_port\")):\n    raise HTTPException(status_code=400, detail=\"Configure MCP Composer auth settings for this project first\")\nsse_url = await get_composer_sse_url(project)","handlingStrategy":"validation","validationCode":"from langflow.services.auth.utils import decrypt_auth_settings  # adjust import to actual module\n\ndef has_mcp_composer_auth(project) -> bool:\n    \"\"\"True when the project can serve a Composer SSE URL.\"\"\"\n    if not getattr(project, \"auth_settings\", None):\n        return False\n    settings = decrypt_auth_settings(project.auth_settings)\n    return bool(settings) and bool(settings.get(\"oauth_host\")) and bool(settings.get(\"oauth_port\"))","typeGuard":null,"tryCatchPattern":"try:\n    sse_url = await get_composer_sse_url(project)\nexcept ValueError as e:\n    if \"Auth config is missing\" in str(e):\n        raise HTTPException(\n            status_code=400,\n            detail=\"MCP Composer is not configured for this project. Set oauth host/port and credentials in project settings.\",\n        ) from e\n    raise","preventionTips":["Require Composer auth settings to be saved before enabling MCP Composer features for a project (validate in the settings-save UI flow)","Keep the encryption secret stable across environments, or re-encrypt auth_settings after key rotation, so decrypt_auth_settings never returns empty","In tests, always populate auth_settings on project fixtures that exercise Composer endpoints"],"tags":["mcp","auth","configuration","project-settings","encryption"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}