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