ruvnet/ruflo · error · PodTemplateValidationError

pod-template at ${path}: auditReadView must be an object

Error message

pod-template at ${path}: auditReadView must be an object

What it means

Thrown by validateAuditReadView() when the top-level auditReadView field is not a plain object (null, array, string, number, undefined). The auditReadView object must contain includedEventTypes and retentionDays, defining which event types are surfaced to the business-owner read view and for how long.

Source

Thrown at v3/@claude-flow/cli/src/business-pods/pod-schema.ts:158

  const successCriteria = requireArray(item, 'successCriteria', path, (s, sp) => {
    if (typeof s !== 'string' || s.length === 0) {
      throw new PodTemplateValidationError('successCriteria entries must be non-empty strings', sp);
    }
    return s;
  });
  if (successCriteria.length === 0) {
    throw new PodTemplateValidationError('bench.successCriteria must have ≥1 entry', path);
  }
  const scheduleHours = requireNumber(item, 'scheduleHours', path);
  if (scheduleHours < 1) {
    throw new PodTemplateValidationError('bench.scheduleHours must be ≥1', path);
  }
  return { name, description, successCriteria, scheduleHours };
}

function validateAuditReadView(item: unknown, path: string): PodAuditReadView {
  if (!isObject(item)) {
    throw new PodTemplateValidationError('auditReadView must be an object', path);
  }
  const includedEventTypes = requireArray(item, 'includedEventTypes', path, (s, sp) => {
    if (typeof s !== 'string' || s.length === 0) {
      throw new PodTemplateValidationError('includedEventTypes entries must be non-empty strings', sp);
    }
    return s;
  });
  const retentionDays = requireNumber(item, 'retentionDays', path);
  if (retentionDays < 1) {
    throw new PodTemplateValidationError('auditReadView.retentionDays must be ≥1', path);
  }
  return { includedEventTypes, retentionDays };
}

// POSIX cron — five or six space-separated fields. Permissive on field
// contents (digits, *, -, /, ,) — actual cron evaluation happens at schedule
// time. We only catch obviously malformed values here.
const CRON_RE = /^([\d*/,\-]+\s+){4,5}[\d*/,\-]+$/;

View on GitHub (pinned to 6b01dc5a68)

Solutions

  1. Read the error path (/auditReadView) confirming the field is missing or malformed
  2. Provide a full object: { "includedEventTypes": [...], "retentionDays": N }
  3. Copy the auditReadView block from a known-good reference template

Example fix

// before (field omitted entirely)
// { "name": "sales", ... } // no auditReadView key -> undefined, throws

// after:
"auditReadView": {
  "includedEventTypes": ["reservation.committed", "reservation.budget_exceeded"],
  "retentionDays": 90
}
Defensive patterns

Strategy: validation

Validate before calling

import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';

try {
  const pod = validatePodTemplate(parsedJson);
} catch (e) {
  if (e instanceof PodTemplateValidationError) {
    console.error(`auditReadView error at ${e.path}: ${e.message}`);
  }
}

Try / catch

import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';

try {
  const pod = validatePodTemplate(raw);
} catch (e) {
  if (e instanceof PodTemplateValidationError) {
    console.error(e.message); // path is /auditReadView
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: validatePodTemplate() reads json.auditReadView and passes it to validateAuditReadView(); the value is missing (undefined), null, an array, or a primitive.

Common situations: The auditReadView field was omitted from the template; it was set to a string description; a minimal template skipped the compliance section.

Related errors


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/5351dc72ac7387bb. Report an issue: GitHub.