You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] sanitize_for_json crashes on circular references (RecursionError) #189
sanitize_for_json in server.py:74-83 recursively walks objects but has no cycle detection. If an sktime estimator contains circular references in its attributes (some do via parent/child pointers), this causes RecursionError and crashes the MCP server.
The hasattr(obj, "__dict__") fallback on line 81 catches most non-dict/list objects by converting to str(), but dict/list cycles are uncaught.
How to reproduce
Any tool returning a result containing a circular reference will trigger this. Likely scenario: an estimator with a parent attribute pointing back to a container.
Looks like this was fixed by a26e3d1 (#515), sanitize_for_json has a _seen guard at server.py:159-168 now, with a test at test_sanitize.py:141. Might be closeable.
Activity
SarthakB11 commentedon Apr 13, 2026
Happy to open a PR for this — have a fix ready locally.
fix(sktime#189): add cycle detection to sanitize_for_json to prevent …
Shashankss1205 commentedon Sep 6, 2026
Still reproducible on main; PR #515 adds the cycle guard and tests and is being merged now.
Me-Priyank commentedon Sep 20, 2026
Looks like this was fixed by a26e3d1 (#515), sanitize_for_json has a _seen guard at server.py:159-168 now, with a test at test_sanitize.py:141. Might be closeable.