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