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