diff --git a/server.py b/server.py index 4f22efb68..8ca6622f6 100644 --- a/server.py +++ b/server.py @@ -795,10 +795,13 @@ class PromptServer(): result still returns ``{}`` with HTTP 200 rather than 404 — absence of an error is a valid answer for this endpoint. """ + # Coalesce empty-string query values to None so `?source=` (param + # present but blank) is treated the same as the param being absent + # — rather than filtering for entries whose source is literally "". grouped = nodes.filter_node_startup_errors( - source=request.query.get("source"), - module_name=request.query.get("module_name"), - pack_id=request.query.get("pack_id"), + source=request.query.get("source") or None, + module_name=request.query.get("module_name") or None, + pack_id=request.query.get("pack_id") or None, ) return web.json_response(grouped) diff --git a/tests-unit/node_startup_errors_test.py b/tests-unit/node_startup_errors_test.py index cf66f8e3b..0afe01fc4 100644 --- a/tests-unit/node_startup_errors_test.py +++ b/tests-unit/node_startup_errors_test.py @@ -218,6 +218,11 @@ def test_filter_node_startup_errors_source_filter(): assert set(grouped["comfy_extras"]) == {"B"} # Non-matching source filter returns an empty dict, not an error. assert nodes.filter_node_startup_errors(source="nope") == {} + # An explicit empty-string filter is treated as a real value (matches + # entries whose source is literally ""), NOT silently as "no filter". + # The HTTP route layer is responsible for coalescing `?source=` to None + # before calling this helper; this assertion locks that contract in. + assert nodes.filter_node_startup_errors(source="") == {} def test_filter_node_startup_errors_module_name_filter():