{"record":{"id":"28bdf9a9f94ba40c","repo":"ruvnet/ruflo","slug":"invalid-outputdim-this-config-outputdim-must","errorCode":null,"errorMessage":"Invalid outputDim: ${this.config.outputDim}. Must be positive.","messagePattern":"Invalid outputDim: (.+?)\\. Must be positive\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts","lineNumber":485,"sourceCode":"  readonly type: GNNLayerType;\n  readonly config: GNNLayerConfig;\n\n  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);","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts#L467-L503","documentation":"BaseGNNLayer.validateConfig() (gnn.ts:485) rejects non-positive outputDim at construction time. outputDim sizes the layer's outgoing node embeddings and its weight matrix, so 0 or negative values cannot produce a valid layer. createLayer() defaults outputDim to 64 when omitted, so this fires only when an explicit invalid value is supplied.","triggerScenarios":"new GATLayer({ type: 'gat', inputDim: 64, outputDim: -1 }); dimension schedules (e.g. Math.floor(hidden/2)) that evaluate to 0 for small hidden sizes; deserializing a layer config where outputDim is absent and coerced to 0.","commonSituations":"Auto-generated architectures that halve dimensions each layer until they hit zero; config typos (negative sign); width hyperparameter of 0 from a sweep.","solutions":["Pass a positive integer outputDim (or omit it to accept the default 64)","Clamp generated dimension schedules: outputDim = Math.max(1, Math.floor(prev / 2))","Validate loaded configs (JSON checkpoints, sweeps) for dimension fields > 0 before constructing layers"],"exampleFix":"// before\nconst layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: hidden }); // hidden = 0 -> throws\n\n// after\nconst hidden = Math.max(1, Math.floor(config.hiddenUnits));\nconst layer = new GCNLayer({ type: 'gcn', inputDim: 128, outputDim: hidden });","handlingStrategy":"validation","validationCode":"if (!(Number.isInteger(cfg.outputDim) && cfg.outputDim > 0)) {\n  throw new TypeError(`outputDim must be a positive integer, got ${cfg.outputDim}`);\n}\nconst layer = registry.createLayer('gcn', cfg);","typeGuard":"function isValidDim(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v > 0;\n}","tryCatchPattern":"try {\n  layer = new GCNLayer(config);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Invalid outputDim')) {\n    config = { ...config, outputDim: 64 }; // safe default\n    layer = new GCNLayer(config);\n  } else throw err;\n}","preventionTips":["Clamp generated width schedules with Math.max(1, n) so halving chains never reach 0","Treat 0 in external config as 'unset' and delete the key to take library defaults","Validate sweep outputs before feeding them to layer constructors"],"tags":["gnn","validation","constructor","configuration"],"backgroundTag":"argument-validation-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}