Open History to see the last commit
1---
2id: HavingRequiresGroupByError
3title: HavingRequiresGroupByError
4---
5
6Defined in: [packages/db/src/errors.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L503)
7
8## Extends
9
10- [`QueryCompilationError`](QueryCompilationError.md)
11
12## Constructors
13
14### Constructor
15
16```ts
17new HavingRequiresGroupByError(): HavingRequiresGroupByError;
18```
19
20Defined in: [packages/db/src/errors.ts:504](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L504)
21
22#### Returns
23
24`HavingRequiresGroupByError`
25
26#### Overrides
27
28[`QueryCompilationError`](QueryCompilationError.md).[`constructor`](QueryCompilationError.md#constructor)
29
30## Properties
31
32### cause?
33
34```ts
35optional cause: unknown;
36```
37
38Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
39
40#### Inherited from
41
42[`QueryCompilationError`](QueryCompilationError.md).[`cause`](QueryCompilationError.md#cause)
43
44***
45
46### message
47
48```ts
49message: string;
50```
51
52Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077
53
54#### Inherited from
55
56[`QueryCompilationError`](QueryCompilationError.md).[`message`](QueryCompilationError.md#message)
57
58***
59
60### name
61
62```ts
63name: string;
64```
65
66Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
67
68#### Inherited from
69
70[`QueryCompilationError`](QueryCompilationError.md).[`name`](QueryCompilationError.md#name)
71
72***
73
74### stack?
75
76```ts
77optional stack: string;
78```
79
80Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
81
82#### Inherited from
83
84[`QueryCompilationError`](QueryCompilationError.md).[`stack`](QueryCompilationError.md#stack)
85
86***
87
88### stackTraceLimit
89
90```ts
91static stackTraceLimit: number;
92```
93
94Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67
95
96The `Error.stackTraceLimit` property specifies the number of stack frames
97collected by a stack trace (whether generated by `new Error().stack` or
98`Error.captureStackTrace(obj)`).
99
100The default value is `10` but may be set to any valid JavaScript number. Changes
101will affect any stack trace captured _after_ the value has been changed.
102
103If set to a non-number value, or set to a negative number, stack traces will
104not capture any frames.
105
106#### Inherited from
107
108[`QueryCompilationError`](QueryCompilationError.md).[`stackTraceLimit`](QueryCompilationError.md#stacktracelimit)
109
110## Methods
111
112### captureStackTrace()
113
114```ts
115static captureStackTrace(targetObject, constructorOpt?): void;
116```
117
118Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:51
119
120Creates a `.stack` property on `targetObject`, which when accessed returns
121a string representing the location in the code at which
122`Error.captureStackTrace()` was called.
123
124```js
125const myObject = {};
126Error.captureStackTrace(myObject);
127myObject.stack; // Similar to `new Error().stack`
128```
129
130The first line of the trace will be prefixed with
131`${myObject.name}: ${myObject.message}`.
132
133The optional `constructorOpt` argument accepts a function. If given, all frames
134above `constructorOpt`, including `constructorOpt`, will be omitted from the
135generated stack trace.
136
137The `constructorOpt` argument is useful for hiding implementation
138details of error generation from the user. For instance:
139
140```js
141function a() {
142 b();
143}
144
145function b() {
146 c();
147}
148
149function c() {
150 // Create an error without stack trace to avoid calculating the stack trace twice.
151 const { stackTraceLimit } = Error;
152 Error.stackTraceLimit = 0;
153 const error = new Error();
154 Error.stackTraceLimit = stackTraceLimit;
155
156 // Capture the stack trace above function b
157 Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
158 throw error;
159}
160
161a();
162```
163
164#### Parameters
165
166##### targetObject
167
168`object`
169
170##### constructorOpt?
171
172`Function`
173
174#### Returns
175
176`void`
177
178#### Inherited from
179
180[`QueryCompilationError`](QueryCompilationError.md).[`captureStackTrace`](QueryCompilationError.md#capturestacktrace)
181
182***
183
184### prepareStackTrace()
185
186```ts
187static prepareStackTrace(err, stackTraces): any;
188```
189
190Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55
191
192#### Parameters
193
194##### err
195
196`Error`
197
198##### stackTraces
199
200`CallSite`[]
201
202#### Returns
203
204`any`
205
206#### See
207
208https://v8.dev/docs/stack-trace-api#customizing-stack-traces
209
210#### Inherited from
211
212[`QueryCompilationError`](QueryCompilationError.md).[`prepareStackTrace`](QueryCompilationError.md#preparestacktrace)