toeverything/AFFiNE · error · Error
FrameworkStackProvider must have at least one provider
Error message
FrameworkStackProvider must have at least one provider
What it means
A constructor validation error on FrameworkStackProvider: it fires when the class is instantiated with an empty providers array. FrameworkStackProvider delegates its collection and eventBus to the first provider in the stack, so at least one provider is structurally required; the faulting input is the empty providers array passed to the constructor.
Source
Thrown at packages/common/infra/src/framework/core/provider.ts:333
dispose(): void {
if (this.disposed) {
return;
}
this.disposed = true;
this.cache.dispose();
this.eventBus.dispose();
}
}
export class FrameworkStackProvider extends FrameworkProvider {
public readonly stack: FrameworkProvider[];
public readonly collection: Framework;
public readonly eventBus: EventBus;
constructor(providers: FrameworkProvider[]) {
if (providers.length === 0) {
throw new Error('FrameworkStackProvider must have at least one provider');
}
super();
this.stack = [...providers];
// use the collection and eventBus from the first provider
this.collection = this.stack[0].collection;
this.eventBus = this.stack[0].eventBus;
}
get scope(): FrameworkScopeStack {
return this.stack[0]?.scope || [];
}
getRaw(identifier: IdentifierValue, options?: ResolveOptions): any {
for (const provider of this.stack) {
const service = provider.getRaw(identifier, {
...options,
optional: true,View on GitHub (pinned to b4c8548c09)
Solutions
- Pass at least one provider when constructing the FrameworkStackProvider.
- Check for an empty providers array, possibly from a conditional that filtered everything out.
- Remove the stack provider if it is not needed.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/common/infra/src/framework/core/provider.ts:333 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/6e9c73f29fb87f26.
Report an issue: GitHub.