{"record":{"id":"360c8436a3b825e8","repo":"ruvnet/ruflo","slug":"dropoutrate-must-be-between-0-and-1","errorCode":null,"errorMessage":"dropoutRate must be between 0 and 1","messagePattern":"dropoutRate must be between 0 and 1","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/integration/src/attention-coordinator.ts","lineNumber":488,"sourceCode":"    return {\n      avgLatencyMs: 0,\n      throughputTps: 0,\n      memoryEfficiency: 1.0,\n      cacheHitRate: 0,\n      totalOperations: 0,\n      speedupFactor: 1.0,\n    };\n  }\n\n  private validateConfig(): void {\n    if (this.config.numHeads <= 0) {\n      throw new Error('numHeads must be positive');\n    }\n    if (this.config.headDim <= 0) {\n      throw new Error('headDim must be positive');\n    }\n    if (this.config.dropoutRate < 0 || this.config.dropoutRate > 1) {\n      throw new Error('dropoutRate must be between 0 and 1');\n    }\n    if (this.config.flashOptLevel < 0 || this.config.flashOptLevel > 3) {\n      throw new Error('flashOptLevel must be between 0 and 3');\n    }\n  }\n\n  private async prewarmCache(): Promise<void> {\n    // Pre-compute common attention patterns\n    // This is a no-op in the simplified implementation\n  }\n\n  /**\n   * Perform attention computation\n   *\n   * ADR-001: For sequences longer than 512 tokens, delegates to\n   * agentic-flow's native Flash Attention (approximate sparse attention;\n   * speedup unverified — see docs/reviews/intelligence-system-audit-2026-05-29.md).\n   */","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/integration/src/attention-coordinator.ts#L470-L506","documentation":"Thrown by AttentionCoordinator#validateConfig (v3/@claude-flow/integration/src/attention-coordinator.ts:488) when config.dropoutRate is outside [0, 1]. Dropout is a probability, so negative values or values above 1 are rejected (both boundaries inclusive — 0 and 1 are valid).","triggerScenarios":"Passing dropoutRate: 5 (a percentage instead of a fraction), -1, or NaN-sourced values; configs shared with a library that expresses dropout in percent (0–100); values parsed from strings ('0.1' works via coercion, but '1e-' style typos yield NaN which passes the range check silently only if NaN — note NaN < 0 is false and NaN > 1 is false, so NaN slips through; the thrown case is concrete out-of-range numbers).","commonSituations":"Porting a config from a framework using percent dropout; hand-edited YAML with a typo like 0..1; LLM-generated config with plausible-looking but wrong values.","solutions":["Express dropout as a fraction in [0, 1] — e.g. 0.1 for 10%, not 10.","If your config stores percent, convert before constructing: dropoutRate: percent / 100.","Add a config lint that clamps or rejects out-of-range probabilities at load time."],"exampleFix":"// before\nnew AttentionCoordinator({ dropoutRate: 10 }); // meant 10%\n\n// after\nnew AttentionCoordinator({ dropoutRate: 0.1 }); // fraction","handlingStrategy":"validation","validationCode":"function toProbability(v: unknown, fallback = 0.1): number {\n  const n = typeof v === 'number' ? v : Number(v);\n  return Number.isFinite(n) && n >= 0 && n <= 1 ? n : fallback;\n}\nnew AttentionCoordinator({ ...cfg, dropoutRate: toProbability(cfg.dropoutRate) });","typeGuard":"function isProbability(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;\n}","tryCatchPattern":"try {\n  coord = new AttentionCoordinator(cfg);\n} catch (e) {\n  if ((e as Error).message === 'dropoutRate must be between 0 and 1') {\n    coord = new AttentionCoordinator({ ...cfg, dropoutRate: 0.1 });\n  } else throw e;\n}","preventionTips":["Store dropout as a fraction everywhere — document 0.1 = 10%.","Convert percent configs at the boundary: value / 100.","NaN bypasses the range check (NaN comparisons are false) — always check Number.isFinite too."],"tags":["config-validation","attention","range-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}