From b86b5590602f2b40cd7ac5853bb894b05ebf8323 Mon Sep 17 00:00:00 2001 From: Mothership Date: Tue, 31 Mar 2026 16:38:25 +0000 Subject: [PATCH] fix(traverse_lineage): return graceful message on 404 instead of raw error When an asset has no lineage or the GUID doesn't exist in the lineage graph, the API returns 404. Previously this propagated as a raw NotFoundError message. Now we catch NotFoundError specifically and return a user-friendly message with error: None, matching the existing "no results" pattern. Co-Authored-By: Claude Opus 4.6 --- modelcontextprotocol/tools/lineage.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modelcontextprotocol/tools/lineage.py b/modelcontextprotocol/tools/lineage.py index e8646c00..397bc69f 100644 --- a/modelcontextprotocol/tools/lineage.py +++ b/modelcontextprotocol/tools/lineage.py @@ -2,6 +2,7 @@ from typing import Dict, Any, List, Optional, Union from client import get_atlan_client +from pyatlan.errors import NotFoundError from pyatlan.model.enums import LineageDirection from pyatlan.model.lineage import FluentLineage from pyatlan.model.fields.atlan_fields import AtlanField @@ -109,6 +110,15 @@ def traverse_lineage( ) return {"assets": results_list, "error": None} + except NotFoundError: + logger.info( + f"No lineage found for asset {guid} (404 from lineage API)" + ) + return { + "assets": [], + "error": None, + "message": "No lineage found for this asset. It may not have upstream or downstream connections in the catalog.", + } except Exception as e: logger.error(f"Error traversing lineage: {str(e)}") return {"assets": [], "error": str(e)}