Stirling-Tools/Stirling-PDF · warning · Error

Invalid automation config: missing 'operations' array

Error message

Invalid automation config: missing 'operations' array

What it means

Thrown by parseAutomationConfigJson when the value is an object but obj.operations is not an array. The Automate format requires a top-level operations array.

Source

Thrown at frontend/editor/src/core/utils/automationConverter.ts:322

/**
 * Parse a native Automate JSON file (a previously-exported AutomationConfig).
 * The id / createdAt / updatedAt fields are dropped — the storage layer
 * regenerates them on save.
 */
export function parseAutomationConfigJson(
  raw: unknown,
  toolRegistry: Partial<ToolRegistry>,
): {
  automation: Omit<AutomationConfig, "id" | "createdAt" | "updatedAt">;
  unresolvedOperations: string[];
} {
  if (!raw || typeof raw !== "object") {
    throw new Error("Invalid automation config: expected JSON object");
  }
  const obj = raw as Record<string, unknown>;
  const operations = obj.operations;
  if (!Array.isArray(operations)) {
    throw new Error("Invalid automation config: missing 'operations' array");
  }

  const unresolved: string[] = [];
  const parsedOperations: AutomationOperation[] = operations.map(
    (op: unknown, index: number) => {
      if (!op || typeof op !== "object") {
        throw new Error(
          `Invalid automation config: operations[${index}] is not an object`,
        );
      }
      const opObj = op as Record<string, unknown>;
      const operation = opObj.operation;
      if (typeof operation !== "string" || operation.length === 0) {
        throw new Error(
          `Invalid automation config: operations[${index}].operation must be a non-empty string`,
        );
      }
      const parameters = (opObj.parameters as Record<string, any>) || {};

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Confirm the file has a top-level "operations": [...] array.
  2. Use auto-detect (omit expectedFormat).
  3. Re-export the config from the Automate tool.

Example fix

// before
if (!Array.isArray(operations)) throw new Error('missing operations array');

// after
if (detectAutomationFormat(raw) !== 'automate') {
  throw new Error('File is not Automate format (no operations array).');
}
Defensive patterns

Strategy: validation

Validate before calling

if (detectAutomationFormat(raw) !== 'automate') {
  throw new Error('File is not Automate format.');
}

Type guard

function hasOperationsArray(raw: unknown): boolean {
  return !!raw && typeof raw === 'object' && !Array.isArray(raw)
    && Array.isArray((raw as any).operations);
}

Prevention

When it happens

Trigger: The object has no operations key, operations is not an array, or a folder-scanning file (pipeline[]) was parsed as Automate.

Common situations: Hand-edit removed/renamed operations; importing a folder-scanning file as Automate; a typo in the key.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/6086741d30222f4d. Report an issue: GitHub.