Stirling-Tools/Stirling-PDF · warning · Error

Invalid automation config: operations[${index}].operation mu

Error message

Invalid automation config: operations[${index}].operation must be a non-empty string

What it means

Thrown when an operation entry's operation field is missing, not a string, or empty. It must be a non-empty frontend tool id present in the tool registry.

Source

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

  }
  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>) || {};
      if (!isToolIdInRegistry(operation, toolRegistry)) {
        unresolved.push(operation);
      }
      return { operation, parameters };
    },
  );

  const name =
    typeof obj.name === "string" && obj.name.length > 0
      ? obj.name
      : "Imported Automation";

  return {
    automation: {

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Ensure each entry has a non-empty string operation matching a known tool id.
  2. Re-export the config.
  3. Validate against the current tool registry before running.

Example fix

// before
if (typeof operation !== 'string' || operation.length === 0) throw new Error('operation must be a non-empty string');

// after
const known = new Set(Object.keys(toolRegistry));
const bad = operations.findIndex((o) => typeof (o as any)?.operation !== 'string' || !known.has((o as any).operation));
if (bad !== -1) throw new Error(`operations[${bad}].operation is missing or unknown.`);
Defensive patterns

Strategy: validation

Validate before calling

const known = new Set(Object.keys(toolRegistry));
const ok = operations.every((o) => typeof (o as any)?.operation === 'string' && known.has((o as any).operation));
if (!ok) throw new Error('Each operation must be a known tool id.');

Type guard

function entryHasKnownOperation(o: unknown, registry: Partial<ToolRegistry>): boolean {
  const op = (o as any)?.operation;
  return typeof op === 'string' && op.length > 0 && Object.prototype.hasOwnProperty.call(registry, op);
}

Prevention

When it happens

Trigger: op.operation is undefined, null, a number, or an empty string.

Common situations: A typo; an incomplete entry; an export referencing a tool id that was removed or renamed.

Related errors


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