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