ruvnet/ruflo · error

Circular dependency detected: ${name}

Error message

Circular dependency detected: ${name}

What it means

During dependency resolution the DFS visit() found the plugin name already on the visiting stack, proving a cycle in the plugin dependency graph (A depends on B depends on ... depends on A). No valid load order exists, so the name is reported as the node where the cycle closed.

Source

Thrown at v3/@claude-flow/plugins/src/registry/plugin-registry.ts:337

    this.initialized = false;
  }

  // =========================================================================
  // Dependency Resolution
  // =========================================================================

  /**
   * Resolve dependencies and return load order.
   */
  private resolveDependencies(): string[] {
    const visited = new Set<string>();
    const visiting = new Set<string>();
    const order: string[] = [];

    const visit = (name: string): void => {
      if (visited.has(name)) return;
      if (visiting.has(name)) {
        throw new Error(`Circular dependency detected: ${name}`);
      }

      const entry = this.plugins.get(name);
      if (!entry) {
        throw new Error(`Missing dependency: ${name}`);
      }

      visiting.add(name);

      const deps = entry.plugin.metadata.dependencies ?? [];
      for (const dep of deps) {
        visit(dep);
      }

      visiting.delete(name);
      visited.add(name);
      order.push(name);
    };

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Break the cycle by removing or inverting one of the declared dependencies.
  2. Extract the shared functionality into a third plugin both can depend on.
Defensive patterns

Strategy: validation

When it happens

Trigger: Dependency resolution detects a cycle involving the named plugin.

Common situations: Plugin A depends on B which (transitively) depends back on A.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/6ccb3731d7671337. Report an issue: GitHub.