{"record":{"id":"2fe1a5708306f41e","repo":"ruvnet/ruflo","slug":"invalid-dropout-this-config-dropout-must-be-b","errorCode":null,"errorMessage":"Invalid dropout: ${this.config.dropout}. Must be between 0 and 1.","messagePattern":"Invalid dropout: (.+?)\\. Must be between 0 and 1\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts","lineNumber":488,"sourceCode":"  constructor(config: GNNLayerConfig) {\n    this.type = config.type;\n    this.config = config;\n    this.validateConfig();\n  }\n\n  /**\n   * Validate layer configuration.\n   * @throws Error if configuration is invalid\n   */\n  protected validateConfig(): void {\n    if (this.config.inputDim <= 0) {\n      throw new Error(`Invalid inputDim: ${this.config.inputDim}. Must be positive.`);\n    }\n    if (this.config.outputDim <= 0) {\n      throw new Error(`Invalid outputDim: ${this.config.outputDim}. Must be positive.`);\n    }\n    if (this.config.dropout !== undefined && (this.config.dropout < 0 || this.config.dropout > 1)) {\n      throw new Error(`Invalid dropout: ${this.config.dropout}. Must be between 0 and 1.`);\n    }\n    if (this.config.numHeads !== undefined && this.config.numHeads <= 0) {\n      throw new Error(`Invalid numHeads: ${this.config.numHeads}. Must be positive.`);\n    }\n  }\n\n  abstract forward(graph: GraphData): Promise<GNNOutput>;\n  abstract messagePass(nodes: NodeFeatures, edges: EdgeFeatures): Promise<NodeFeatures>;\n\n  /**\n   * Aggregate messages using the specified method.\n   */\n  async aggregate(messages: Message[], method: AggregationMethod): Promise<number[]> {\n    if (messages.length === 0) {\n      return new Array(this.config.outputDim).fill(0);\n    }\n\n    const vectors = messages.map((m) => m.vector);","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts#L470-L506","documentation":"BaseGNNLayer.validateConfig() (gnn.ts:488) enforces dropout to lie in [0, 1], since dropout is a probability. Values below 0 or above 1 are rejected at construction; 0 and 1 themselves are allowed. Defaults come from GNN_DEFAULTS when unset, so this only triggers on an explicitly supplied out-of-range value.","triggerScenarios":"new GATLayer({ type: 'gat', dropout: 1.5, ... }); passing a percentage (e.g. 20 for 20%) instead of a fraction; hyperparameter sweeps stepping outside [0,1]; env/CLI config parsed with an extra decimal shift.","commonSituations":"Config authored as percent rather than probability; ML framework porting where dropout semantics differ; typo like 0.55 vs 5.5.","solutions":["Express dropout as a fraction in [0, 1] (0.2 for 20%)","If your config uses percentages, convert before constructing: dropout: cfg.dropoutPct / 100","Clamp sweep values: Math.min(1, Math.max(0, d)) when a stray value is acceptable"],"exampleFix":"// before\nconst layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: 64, dropout: 20 }); // 20% as int -> throws\n\n// after\nconst layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: 64, dropout: 0.2 });","handlingStrategy":"validation","validationCode":"if (cfg.dropout !== undefined && (cfg.dropout < 0 || cfg.dropout > 1)) {\n  throw new RangeError(`dropout must be within [0,1], got ${cfg.dropout}`);\n}\nconst layer = registry.createLayer('gat', cfg);","typeGuard":"function isValidDropout(v: unknown): v is number {\n  return typeof v === 'number' && v >= 0 && v <= 1;\n}","tryCatchPattern":"try {\n  layer = new GATLayer(config);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Invalid dropout')) {\n    config = { ...config, dropout: Math.min(1, Math.max(0, config.dropout)) };\n    layer = new GATLayer(config);\n  } else throw err;\n}","preventionTips":["Author dropout as a fraction (0.2), never a percentage (20)","If configs store percentages, divide by 100 at the loading boundary","Clamp user-supplied dropout from UIs/sweeps into [0,1] before construction"],"tags":["gnn","validation","hyperparameter","range-error"],"backgroundTag":"value-out-of-range","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}