{"record":{"id":"e19e43604d15d028","repo":"ruvnet/ruflo","slug":"messages-are-required","errorCode":null,"errorMessage":"Messages are required","messagePattern":"Messages are required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/mcp/src/sampling.ts","lineNumber":225,"sourceCode":"    requestCount: number;\n    totalTokens: number;\n    providerCount: number;\n    defaultProvider?: string;\n  } {\n    return {\n      requestCount: this.requestCount,\n      totalTokens: this.totalTokens,\n      providerCount: this.providers.size,\n      defaultProvider: this.defaultProvider,\n    };\n  }\n\n  /**\n   * Validate sampling request\n   */\n  private validateRequest(request: CreateMessageRequest): void {\n    if (!request.messages || request.messages.length === 0) {\n      throw new Error('Messages are required');\n    }\n\n    if (request.maxTokens > this.config.maxTokensLimit) {\n      throw new Error(`maxTokens exceeds limit of ${this.config.maxTokensLimit}`);\n    }\n\n    if (request.temperature !== undefined && (request.temperature < 0 || request.temperature > 2)) {\n      throw new Error('Temperature must be between 0 and 2');\n    }\n  }\n\n  /**\n   * Select provider based on preferences\n   */\n  private selectProvider(preferences?: ModelPreferences): LLMProvider | undefined {\n    // If hints provided, try to find matching provider\n    if (preferences?.hints) {\n      for (const hint of preferences.hints) {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/mcp/src/sampling.ts#L207-L243","documentation":"Request validation in SamplingManager: the CreateMessageRequest carried no messages array (or an empty one). A sampling request with nothing to respond to is malformed, so it is rejected before provider selection.","triggerScenarios":"A sampling request is made with an empty or missing messages array.","commonSituations":"Client sends a createMessage call without messages, or a caller builds the params object incorrectly.","solutions":["Validate the request on the client side and include at least one message in params.messages.","Ensure the caller passes the conversation history instead of an empty array."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}