langflow-ai/langflow · error · HTTPException

Project not found

Error message

Project not found

What it means

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.

Source

Thrown at src/backend/base/langflow/api/v1/mcp_projects.py:117

    composer_backend_token: str | None = None,
) -> User:
    """MCP-specific user authentication that allows fallback to username lookup when not using API key auth.

    This function provides authentication for MCP endpoints when using MCP Composer and no API key is provided,
    or checks if the API key is valid.
    """
    # Mirror the service.py auth entrypoints: reset request-local credential metadata at entry so a
    # later branch (e.g. the composer-token fast path) never inherits stale context from a prior call.
    clear_current_auth_context()
    # Defensive invariant: drop any stale external access ceiling so it can't carry into MCP project auth.
    clear_current_external_access_context()

    settings_service = get_settings_service()

    project = (await db.exec(select(Folder).where(Folder.id == project_id))).first()

    if not project:
        raise HTTPException(status_code=404, detail="Project not found")

    auth_settings: AuthSettings | None = None
    # Check if this project requires API key only authentication
    if project.auth_settings:
        auth_settings = AuthSettings(**project.auth_settings)

    project_auth_type = auth_settings.auth_type if auth_settings else None
    if project_auth_type == "oauth" and composer_backend_token:
        mcp_composer_service: MCPComposerService = cast(
            MCPComposerService, get_service(ServiceType.MCP_COMPOSER_SERVICE)
        )
        if mcp_composer_service.validate_backend_auth_token(str(project_id), composer_backend_token):
            if project.user_id:
                project_user = await db.get(User, project.user_id)
                if project_user:
                    return project_user
            raise HTTPException(status_code=404, detail="Project owner not found")

View on GitHub (pinned to 976ec789d2)

Solutions

  1. List your projects (GET /api/v1/folders/ or the projects API) and copy the exact current project id.
  2. Confirm you are pointing the MCP client at the same Langflow instance/environment that owns the project.
  3. If the project was deleted, recreate it and update the MCP endpoint configuration.
  4. Validate the id is a well-formed UUID before configuring the client.
Defensive patterns

Strategy: validation

Validate before calling

from uuid import UUID

def valid_project_id(pid: str) -> bool:
    try:
        UUID(pid); return True
    except (ValueError, TypeError):
        return False

# plus liveness: GET /api/v1/folders/ and confirm pid in results

Try / catch

except HTTPError as e: if e.response.status_code == 404: surface 'project missing/deleted' to config, not retry.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/a5d824a979346e0d. Report an issue: GitHub.