Skip to content

Commit c74b437

Browse files
committed
Avoid KeyError
1 parent 55e4d0b commit c74b437

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,8 @@ def get_entity_by_id(id):
883883
# Due to the use of entity cache from `query_target_entity()`, we don't want to exclude the `neo4j_top_props_to_skip`
884884
# from actual Neo4j query. And it's not s performance concern neither. - Zhou 10/1/2025
885885
for item in neo4j_top_props_to_skip:
886-
complete_dict.pop(item)
886+
# Use default value to avoid KeyError if the key is not found
887+
complete_dict.pop(item, f'Key {item} not found')
887888

888889
# Also normalize the result based on schema
889890
final_result = schema_manager.normalize_entity_result_for_response(complete_dict)

0 commit comments

Comments
 (0)