ruvnet/ruflo · error
Invalid dropout: ${this.config.dropout}. Must be between 0 a
Error message
Invalid dropout: ${this.config.dropout}. Must be between 0 and 1. What it means
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.
Source
Thrown at v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts:488
constructor(config: GNNLayerConfig) {
this.type = config.type;
this.config = config;
this.validateConfig();
}
/**
* Validate layer configuration.
* @throws Error if configuration is invalid
*/
protected validateConfig(): void {
if (this.config.inputDim <= 0) {
throw new Error(`Invalid inputDim: ${this.config.inputDim}. Must be positive.`);
}
if (this.config.outputDim <= 0) {
throw new Error(`Invalid outputDim: ${this.config.outputDim}. Must be positive.`);
}
if (this.config.dropout !== undefined && (this.config.dropout < 0 || this.config.dropout > 1)) {
throw new Error(`Invalid dropout: ${this.config.dropout}. Must be between 0 and 1.`);
}
if (this.config.numHeads !== undefined && this.config.numHeads <= 0) {
throw new Error(`Invalid numHeads: ${this.config.numHeads}. Must be positive.`);
}
}
abstract forward(graph: GraphData): Promise<GNNOutput>;
abstract messagePass(nodes: NodeFeatures, edges: EdgeFeatures): Promise<NodeFeatures>;
/**
* Aggregate messages using the specified method.
*/
async aggregate(messages: Message[], method: AggregationMethod): Promise<number[]> {
if (messages.length === 0) {
return new Array(this.config.outputDim).fill(0);
}
const vectors = messages.map((m) => m.vector);View on GitHub (pinned to fa13ee4ad6)
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
Example fix
// before
const layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: 64, dropout: 20 }); // 20% as int -> throws
// after
const layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: 64, dropout: 0.2 }); Defensive patterns
Strategy: validation
Validate before calling
if (cfg.dropout !== undefined && (cfg.dropout < 0 || cfg.dropout > 1)) {
throw new RangeError(`dropout must be within [0,1], got ${cfg.dropout}`);
}
const layer = registry.createLayer('gat', cfg); Type guard
function isValidDropout(v: unknown): v is number {
return typeof v === 'number' && v >= 0 && v <= 1;
} Try / catch
try {
layer = new GATLayer(config);
} catch (err) {
if (err instanceof Error && err.message.includes('Invalid dropout')) {
config = { ...config, dropout: Math.min(1, Math.max(0, config.dropout)) };
layer = new GATLayer(config);
} else throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Config authored as percent rather than probability; ML framework porting where dropout semantics differ; typo like 0.55 vs 5.5.
Related errors
- Invalid inputDim: ${this.config.inputDim}. Must be positive.
- Invalid outputDim: ${this.config.outputDim}. Must be positiv
- Invalid numHeads: ${this.config.numHeads}. Must be positive.
- localCompute: no adapter for graphId=${input.graphId}
- Invalid completion type
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/2fe1a5708306f41e.
Report an issue: GitHub.