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