diff --git a/src/oc_erchef/apps/oc_chef_wm/src/chef_wm_search.erl b/src/oc_erchef/apps/oc_chef_wm/src/chef_wm_search.erl index 2311f835da2..f30cda010b1 100644 --- a/src/oc_erchef/apps/oc_chef_wm/src/chef_wm_search.erl +++ b/src/oc_erchef/apps/oc_chef_wm/src/chef_wm_search.erl @@ -360,7 +360,16 @@ make_query_from_params(Req) -> extract_path(_Item, []) -> null; extract_path(Item, Path) -> - ej:get(list_to_tuple(Path), Item, null). + try ej:get(list_to_tuple(Path), Item, null) of + Result -> Result + catch + %% Don't throw a 500 when the user input is invalid + %% This typically happens when the user provides an invalid attribute + %% key, typically trying to access a value as a hash that is actually + %% a string (i.e. uptime.seconds) + error:function_clause -> null; + Error:Reason -> {Error, Reason} + end. make_search_results(BulkGetFun, Ids, BatchSize, Start, NumFound) -> Ans0 = search_result_start(Start, NumFound),