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
- Ensure each entry has a non-empty string operation matching a known tool id.
- Re-export the config.
- 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
- Validate operation ids against the live tool registry before persisting/running.
- Surface unresolvedOperations to the user so renamed/removed tools are visible.
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
- Invalid folder scanning config: expected JSON object
- Invalid folder scanning config: missing 'pipeline' array
- Invalid folder scanning config: pipeline[${index}] is not an
- Invalid folder scanning config: pipeline[${index}].operation
- Invalid automation config: expected JSON object
AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13).
Data as JSON: /api/errors/b12661867453d489.
Report an issue: GitHub.