         return AnyIterator {
             guard let pair = a.next() else { return nil }
             let (groupKey, results) = pair
-            guard var bindings = groupBindings[groupKey] else { fatalError("Unexpected missing aggregation group template") }
+            guard var bindings = groupBindings[groupKey] else {
+                Logger.shared.error("Unexpected missing aggregation group template")
+                fatalError("Unexpected missing aggregation group template")
+            }
             for (agg, name) in aggs {
                 switch agg {
                 case .countAll:

            if case .bound(let g) = graph {
                return try effectiveVersion(matching: child, activeGraph: g)
            } else {
                fatalError("Unimplemented: effectiveVersion(.namedGraph(_), )")
            }
        case .distinct(let child), .project(let child, _), .slice(let child, _, _), .extend(let child, _, _), .order(let child, _), .filter(let child, _):
            return try effectiveVersion(matching: child, activeGraph: activeGraph)

                    case .sample(_):
                        break
                    case .groupConcat(let keyExpr, let sep, false):
                        guard case .datatype(_) = value.type else {
                            Logger.shared.error("Unexpected term in generating GROUP_CONCAT value")
                            throw QueryError.evaluationError("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:
                        Logger.shared.error("unexpected pipelined evaluation for \(agg)")
                        throw QueryError.evaluationError("unexpected pipelined evaluation for \(agg)")
                    }
                } else if let value = numericGroups[groupKey] {
                    switch agg {
