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