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