ruvnet/ruflo · error

Unknown GNN layer type: ${type}. Available types: ${this.get

Error message

Unknown GNN layer type: ${type}. Available types: ${this.getLayerTypes().join(', ')}

What it means

GNNRegistry.createLayer() dispatches to a factory registered per layer type. Built-in registrations (gnn.ts:377-453) cover 'gcn', 'gat', 'gat_v2', 'sage', 'gin', 'mpnn', 'edge_conv', 'point_conv', 'transformer', 'pna', 'film', 'rgcn', 'hgt', 'han', 'metapath'. Requesting any other key throws this error, and the message conveniently lists the available types via getLayerTypes().

Source

Thrown at v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts:326

   * @param type - Layer type to remove
   * @returns Whether the layer was removed
   */
  unregisterLayer(type: GNNLayerType | string): boolean {
    this.defaultConfigs.delete(type);
    return this.factories.delete(type);
  }

  /**
   * Create a GNN layer instance.
   * @param type - Layer type
   * @param config - Layer configuration
   * @returns IGNNLayer instance
   * @throws Error if layer type is not registered
   */
  createLayer(type: GNNLayerType, config: Partial<GNNLayerConfig>): IGNNLayer {
    const factory = this.factories.get(type);
    if (!factory) {
      throw new Error(`Unknown GNN layer type: ${type}. Available types: ${this.getLayerTypes().join(', ')}`);
    }

    const defaultConfig = this.defaultConfigs.get(type) ?? {};
    const fullConfig: GNNLayerConfig = {
      type,
      inputDim: config.inputDim ?? 64,
      outputDim: config.outputDim ?? 64,
      dropout: config.dropout ?? defaultConfig.dropout ?? GNN_DEFAULTS.dropout,
      aggregation: config.aggregation ?? defaultConfig.aggregation ?? GNN_DEFAULTS.aggregation,
      addSelfLoops: config.addSelfLoops ?? defaultConfig.addSelfLoops ?? GNN_DEFAULTS.addSelfLoops,
      normalize: config.normalize ?? defaultConfig.normalize ?? GNN_DEFAULTS.normalize,
      useBias: config.useBias ?? defaultConfig.useBias ?? GNN_DEFAULTS.useBias,
      activation: config.activation ?? defaultConfig.activation ?? GNN_DEFAULTS.activation,
      ...config,
    };

    return factory(fullConfig);
  }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Read the error message: it lists every available type — pick the closest match (e.g. 'sage' for GraphSAGE)
  2. Guard user/config input with registry.getLayerTypes().includes(type) before calling createLayer
  3. For custom layers, register a factory first via registry.registerLayer('my_layer', factory, defaults)
  4. Check exact casing: built-ins are lowercase with underscores ('gat_v2', 'edge_conv')

Example fix

// before
const layer = registry.createLayer('GraphConv' as GNNLayerType, { inputDim: 64 }); // throws

// after
const layer = registry.createLayer('gcn', { inputDim: 64, outputDim: 64 });
Defensive patterns

Strategy: validation

Validate before calling

const layerType = cfg.layer as string;
const available = registry.getLayerTypes();
if (!available.includes(layerType)) {
  throw new Error(`Unsupported layer '${layerType}'. Supported: ${available.join(', ')}`);
}
const layer = registry.createLayer(layerType as GNNLayerType, cfg);

Type guard

function isGNNLayerType(registry: GNNRegistry, type: string): type is GNNLayerType {
  return registry.getLayerTypes().includes(type);
}

Try / catch

try {
  layer = registry.createLayer(type, config);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Unknown GNN layer type')) {
    // message already lists valid types; surface to config validation
    throw new ConfigError(err.message, { field: 'layer', value: type });
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling registry.createLayer('graphconv', config) with a typo or a layer from another library (PyG/DGL names like 'GraphConv', 'SGConv'); using a layer type registered only after unregisterLayer() was called; passing user-supplied layer names straight from config.

Common situations: Porting PyTorch Geometric model code and reusing its layer names; config files with stale layer names after a library upgrade; case mismatches ('GCN' vs 'gcn').

Related errors


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