toeverything/AFFiNE · error · MissingDependencyError

Missing dependency ${stringifyIdentifier(target)} in creatin

Error message

Missing dependency ${stringifyIdentifier(target)} in creating ${stringifyIdentifier(from)}.\n${stringifyDependencyStack(dependencyStack)}

What it means

runFactory catches a ComponentNotFoundError raised inside a factory and rethrows it as MissingDependencyError naming both the requested and missing identifier plus the dependency stack, turning raw lookup failures into diagnosable wiring errors.

Source

Thrown at packages/common/infra/src/framework/core/provider.ts:192

        });
      }

      if (optional) {
        return undefined;
      }
      throw new ComponentNotFoundError(identifier);
    }

    const runFactory = () => {
      const nextResolver = this.track(identifier);
      try {
        return withContext(() => factory(nextResolver), {
          provider: this.provider,
          props,
        });
      } catch (err) {
        if (err instanceof ComponentNotFoundError) {
          throw new MissingDependencyError(
            identifier,
            err.identifier,
            this.stack
          );
        }
        throw err;
      }
    };

    if (noCache) {
      return runFactory();
    }

    return this.provider.cache.getOrInsert(identifier, runFactory);
  }

  getAllRaw(
    identifier: IdentifierValue,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Register a provider for the missing dependency named in the message.
  2. Follow the printed dependency stack to find which component declares the missing dependency.
  3. Add the module that provides the dependency to the framework setup.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/common/infra/src/framework/core/provider.ts:192 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/3ea79d276b4436e7. Report an issue: GitHub.