Skip to content

Commit a21c66e

Browse files
claude[bot]groksrc
andauthored
fix: handle None from_entity in Context API RelationSummary
Add null check before accessing from_entity.title to prevent AttributeError when relations exist but referenced entities are deleted or inconsistent. Follows the same pattern already used for to_entity handling. Fixes #165 Co-authored-by: Drew Cain <groksrc@users.noreply.github.com>
1 parent a52ce1c commit a21c66e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/basic_memory/api/routers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def to_summary(item: SearchIndexRow | ContextResultRow):
5252
file_path=item.file_path,
5353
permalink=item.permalink, # pyright: ignore
5454
relation_type=item.relation_type, # pyright: ignore
55-
from_entity=from_entity.title, # pyright: ignore
55+
from_entity=from_entity.title if from_entity else None,
5656
to_entity=to_entity.title if to_entity else None,
5757
created_at=item.created_at,
5858
)

0 commit comments

Comments
 (0)