ruvnet/ruflo · error · Error

Messages are required

Error message

Messages are required

What it means

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.

Source

Thrown at v3/@claude-flow/mcp/src/sampling.ts:225

    requestCount: number;
    totalTokens: number;
    providerCount: number;
    defaultProvider?: string;
  } {
    return {
      requestCount: this.requestCount,
      totalTokens: this.totalTokens,
      providerCount: this.providers.size,
      defaultProvider: this.defaultProvider,
    };
  }

  /**
   * Validate sampling request
   */
  private validateRequest(request: CreateMessageRequest): void {
    if (!request.messages || request.messages.length === 0) {
      throw new Error('Messages are required');
    }

    if (request.maxTokens > this.config.maxTokensLimit) {
      throw new Error(`maxTokens exceeds limit of ${this.config.maxTokensLimit}`);
    }

    if (request.temperature !== undefined && (request.temperature < 0 || request.temperature > 2)) {
      throw new Error('Temperature must be between 0 and 2');
    }
  }

  /**
   * Select provider based on preferences
   */
  private selectProvider(preferences?: ModelPreferences): LLMProvider | undefined {
    // If hints provided, try to find matching provider
    if (preferences?.hints) {
      for (const hint of preferences.hints) {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Validate the request on the client side and include at least one message in params.messages.
  2. Ensure the caller passes the conversation history instead of an empty array.
Defensive patterns

Strategy: validation

When it happens

Trigger: A sampling request is made with an empty or missing messages array.

Common situations: Client sends a createMessage call without messages, or a caller builds the params object incorrectly.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/e19e43604d15d028. Report an issue: GitHub.