{"record":{"id":"a5d824a979346e0d","repo":"langflow-ai/langflow","slug":"project-not-found-a5d824","errorCode":null,"errorMessage":"Project not found","messagePattern":"Project not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mcp_projects.py","lineNumber":117,"sourceCode":"    composer_backend_token: str | None = None,\n) -> User:\n    \"\"\"MCP-specific user authentication that allows fallback to username lookup when not using API key auth.\n\n    This function provides authentication for MCP endpoints when using MCP Composer and no API key is provided,\n    or checks if the API key is valid.\n    \"\"\"\n    # Mirror the service.py auth entrypoints: reset request-local credential metadata at entry so a\n    # later branch (e.g. the composer-token fast path) never inherits stale context from a prior call.\n    clear_current_auth_context()\n    # Defensive invariant: drop any stale external access ceiling so it can't carry into MCP project auth.\n    clear_current_external_access_context()\n\n    settings_service = get_settings_service()\n\n    project = (await db.exec(select(Folder).where(Folder.id == project_id))).first()\n\n    if not project:\n        raise HTTPException(status_code=404, detail=\"Project not found\")\n\n    auth_settings: AuthSettings | None = None\n    # Check if this project requires API key only authentication\n    if project.auth_settings:\n        auth_settings = AuthSettings(**project.auth_settings)\n\n    project_auth_type = auth_settings.auth_type if auth_settings else None\n    if project_auth_type == \"oauth\" and composer_backend_token:\n        mcp_composer_service: MCPComposerService = cast(\n            MCPComposerService, get_service(ServiceType.MCP_COMPOSER_SERVICE)\n        )\n        if mcp_composer_service.validate_backend_auth_token(str(project_id), composer_backend_token):\n            if project.user_id:\n                project_user = await db.get(User, project.user_id)\n                if project_user:\n                    return project_user\n            raise HTTPException(status_code=404, detail=\"Project owner not found\")\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mcp_projects.py#L99-L135","documentation":"Raised by the MCP project auth helper when no Folder row matches the project_id in the path. Before choosing an auth strategy (oauth composer token, 'none', api key, superuser fallback) the helper loads the project; a miss returns 404 without leaking whether auth would pass. Note this lookup is by id only — existence, not ownership.","triggerScenarios":"GET/POST /api/v1/mcp/project/{project_id}/... with a project_id that does not exist in the folders table: typo'd UUID, project deleted, or wrong environment/database.","commonSituations":"MCP client configured with a stale project URL after the project was deleted; copying URLs between dev/prod instances where ids differ; trailing characters or wrong UUID casing pasted into the endpoint.","solutions":["List your projects (GET /api/v1/folders/ or the projects API) and copy the exact current project id.","Confirm you are pointing the MCP client at the same Langflow instance/environment that owns the project.","If the project was deleted, recreate it and update the MCP endpoint configuration.","Validate the id is a well-formed UUID before configuring the client."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from uuid import UUID\n\ndef valid_project_id(pid: str) -> bool:\n    try:\n        UUID(pid); return True\n    except (ValueError, TypeError):\n        return False\n\n# plus liveness: GET /api/v1/folders/ and confirm pid in results","typeGuard":null,"tryCatchPattern":"except HTTPError as e: if e.response.status_code == 404: surface 'project missing/deleted' to config, not retry.","preventionTips":["Validate project UUID format in client config before first request.","Re-resolve project ids after deletes/recreates instead of caching forever."],"tags":["mcp","http-404","project","routing","auth"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}