Stirling-Tools/Stirling-PDF · warning · Error
Invalid automation config: operations[${index}] is not an ob
Error message
Invalid automation config: operations[${index}] is not an object What it means
Thrown when an element of the operations array is null or not an object. Each operation entry must be an object with operation and parameters.
Source
Thrown at frontend/editor/src/core/utils/automationConverter.ts:329
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>) || {};
if (!isToolIdInRegistry(operation, toolRegistry)) {
unresolved.push(operation);
}
return { operation, parameters };
},
);
View on GitHub (pinned to 9ef20dcab8)
Solutions
- Ensure each operations entry is an object.
- Re-export the config.
- Validate each element before mapping.
Example fix
// before
if (!op || typeof op !== 'object') throw new Error(`operations[${index}] is not an object`);
// after
const valid = operations.every((o) => o && typeof o === 'object' && !Array.isArray(o));
if (!valid) throw new Error('One or more operations are malformed.'); Defensive patterns
Strategy: validation
Validate before calling
const bad = operations.findIndex((o) => !o || typeof o !== 'object' || Array.isArray(o));
if (bad !== -1) throw new Error(`operations[${bad}] is not an object`); Type guard
function isOperationEntry(o: unknown): o is Record<string, unknown> {
return !!o && typeof o === 'object' && !Array.isArray(o);
} Prevention
- Schema-validate operation entries before processing.
- Prefer re-exporting over hand-editing configs.
When it happens
Trigger: An operations entry is a bare string, number, or null rather than { operation, parameters }.
Common situations: Hand-edited JSON; a truncated export; a generator that emitted a flat array of operation names.
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/ff904d26ea33d878.
Report an issue: GitHub.