mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED

Error message

This storage provider does not support batch creating scores

What it means

MastraError OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED. batchCreateScores in the observability storage base class always throws, since batch score writing is an optional backend capability. Hitting it means the provider cannot accept bulk score observations.

Source

Thrown at packages/core/src/storage/domains/observability/base.ts:581

  // ============================================================================

  /**
   * Creates a single score record.
   */
  async createScore(_args: CreateScoreArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_CREATE_SCORE_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support creating scores',
    });
  }

  /**
   * Creates multiple score observations in a single batch.
   */
  async batchCreateScores(_args: BatchCreateScoresArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support batch creating scores',
    });
  }

  /**
   * Retrieves a list of scores with optional filtering.
   */
  async listScores(_args: ListScoresArgs): Promise<ListScoresResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_LIST_SCORES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support listing scores',
    });
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a storage provider implementing batchCreateScores
  2. Override batchCreateScores in your storage class to insert scores in bulk (or loop over createScore)
  3. Catch the error and fall back to per-record createScore calls or buffer scores elsewhere

Example fix

// before
await storage.batchCreateScores({ scores });
// after
try {
  await storage.batchCreateScores({ scores });
} catch (e) {
  if (e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED') {
    for (const s of scores) await storage.createScore(s);
    return;
  }
  throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

async function supportsBatchScores(storage) {
  try { await storage.batchCreateScores({ scores: [] }); return true; }
  catch (e) { return e?.id !== 'OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED'; }
}

Type guard

function isNotImplementedError(e: unknown): e is MastraError {
  return e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED';
}

Try / catch

try {
  await storage.batchCreateScores({ scores });
} catch (e) {
  if (isNotImplementedError(e)) {
    for (const s of scores) await storage.createScore(s);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling batchCreateScores(args) on a storage class relying on the base default; scoring pipelines that flush scores in bulk to an unsupported backend.

Common situations: Bulk evaluation runs (eval datasets) against storage adapters without score support; custom adapters implementing createScore but not the batch variant; batched telemetry exporters pointed at minimal storage.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/8052d463ae52536e. Report an issue: GitHub.