                             groupErrors[groupKey] = QueryError.evaluationError("Non-numeric term in numeric aggregation (\(term))")
                         }
                     default:
-                        fatalError("unexpected pipelined evaluation for \(agg)")
+                        Logger.shared.error("unexpected pipelined evaluation for \(agg)")
+                        throw QueryError.evaluationError("unexpected pipelined evaluation for \(agg)")
                     }
                 } else {
                     switch agg {

                    case .sample(_):
                        break
                    case .groupConcat(let keyExpr, let sep, false):
                        guard case .datatype(_) = value.type else { fatalError("Unexpected term in generating GROUP_CONCAT value") }
                        let string = value.value
                        let term = try self.ee.evaluate(expression: keyExpr, result: result)
                        let updated = string + sep + term.value
                        termGroups[groupKey] = Term(value: updated, type: value.type)
                    default:
                        fatalError("unexpected pipelined evaluation for \(agg)")
                    }
                } else if let value = numericGroups[groupKey] {
                    switch agg {

        let termIterator : AnyIterator<TermResult> = AnyIterator {
            guard let pair = b.next() else { return nil }
            let (groupKey, term) = pair
            guard var bindings = groupBindings[groupKey] else {
                Logger.shared.error("Unexpected missing aggregation group template")
                fatalError("Unexpected missing aggregation group template")
            }
            if let error = groupErrors[groupKey] {
                print("*** error binding aggregate to ?\(name): \(error)")
            } else {
