{"record":{"id":"e651731de2542366","repo":"ruvnet/ruflo","slug":"attention-mechanism-type-not-registered","errorCode":null,"errorMessage":"Attention mechanism '${type}' not registered","messagePattern":"Attention mechanism '(.+?)' not registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugins/src/integrations/ruvector/attention.ts","lineNumber":140,"sourceCode":"    ];\n    categories.forEach(cat => this.categoryIndex.set(cat, new Set()));\n  }\n\n  /**\n   * Register an attention mechanism implementation.\n   */\n  register(impl: IAttentionMechanism): void {\n    this.mechanisms.set(impl.type, impl);\n    this.categoryIndex.get(impl.category)?.add(impl.type);\n  }\n\n  /**\n   * Get an attention mechanism by type.\n   */\n  get(type: AttentionMechanism): IAttentionMechanism {\n    const mechanism = this.mechanisms.get(type);\n    if (!mechanism) {\n      throw new Error(`Attention mechanism '${type}' not registered`);\n    }\n    return mechanism;\n  }\n\n  /**\n   * Check if a mechanism is registered.\n   */\n  has(type: AttentionMechanism): boolean {\n    return this.mechanisms.has(type);\n  }\n\n  /**\n   * List all registered attention mechanisms.\n   */\n  listAvailable(): AttentionMechanism[] {\n    return Array.from(this.mechanisms.keys());\n  }\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugins/src/integrations/ruvector/attention.ts#L122-L158","documentation":"AttentionRegistry is a map of attention mechanism implementations keyed by their type string (e.g. those registered by createDefaultRegistry: multi_head, self, cross, causal, flash, flash_v2, etc.). get(type) throws this error when no mechanism was ever registered under the requested key — either because a custom empty registry was passed to AttentionExecutor, or the type string does not match any registered mechanism.","triggerScenarios":"Calling registry.get(type) or executor.execute(type, input) with a misspelled or unregistered mechanism string; constructing AttentionExecutor with 'new AttentionRegistry()' (empty) instead of createDefaultRegistry(); calling unregister() earlier and then get(); passing a mechanism valid in a newer version on an older build.","commonSituations":"Typos like 'multihead' vs 'multi_head' or 'flash-attention' vs 'flash'; using a custom registry but forgetting to register needed mechanisms; version drift where a mechanism was renamed; JSON/env-driven config supplying an arbitrary mechanism name.","solutions":["Check availability first with registry.has(type) (or list registered types) and fail with a helpful message","If you built the registry yourself, register the mechanism: registry.register(new SelfAttention()) before calling get","Pass createDefaultRegistry() to AttentionExecutor so all built-in mechanisms exist","Verify the exact type string against the AttentionMechanism type union your version exports"],"exampleFix":"// before\nconst impl = registry.get('multihead' as AttentionMechanism); // throws\n\n// after\nif (!registry.has('multi_head')) {\n  registry.register(new MultiHeadAttention());\n}\nconst impl = registry.get('multi_head');","handlingStrategy":"type-guard","validationCode":"const mechanism = inputFromConfig as AttentionMechanism;\nif (!registry.has(mechanism)) {\n  throw new Error(`Unknown attention mechanism '${mechanism}'. Registered: ${Array.from(/* keys via has() probes or */ knownMechanisms).join(', ')}`);\n}","typeGuard":"function isAttentionMechanism(registry: AttentionRegistry, type: string): type is AttentionMechanism {\n  return registry.has(type as AttentionMechanism);\n}","tryCatchPattern":"try {\n  const impl = registry.get(mechanism);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('not registered')) {\n    // fall back to a safe default mechanism or register the requested one\n    registry.register(new SelfAttention());\n  } else throw err;\n}","preventionTips":["Always construct executors with createDefaultRegistry() unless you deliberately want a custom set","Validate mechanism names from config/env with registry.has() before use","Keep mechanism names centralized as typed constants instead of raw strings"],"tags":["registry","attention","ruvector","lookup"],"backgroundTag":"service-not-registered","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}