{"record":{"id":"ff904d26ea33d878","repo":"Stirling-Tools/Stirling-PDF","slug":"invalid-automation-config-operations-index-is","errorCode":null,"errorMessage":"Invalid automation config: operations[${index}] is not an object","messagePattern":"Invalid automation config: operations\\[(.+?)\\] is not an object","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/editor/src/core/utils/automationConverter.ts","lineNumber":329,"sourceCode":"  toolRegistry: Partial<ToolRegistry>,\n): {\n  automation: Omit<AutomationConfig, \"id\" | \"createdAt\" | \"updatedAt\">;\n  unresolvedOperations: string[];\n} {\n  if (!raw || typeof raw !== \"object\") {\n    throw new Error(\"Invalid automation config: expected JSON object\");\n  }\n  const obj = raw as Record<string, unknown>;\n  const operations = obj.operations;\n  if (!Array.isArray(operations)) {\n    throw new Error(\"Invalid automation config: missing 'operations' array\");\n  }\n\n  const unresolved: string[] = [];\n  const parsedOperations: AutomationOperation[] = operations.map(\n    (op: unknown, index: number) => {\n      if (!op || typeof op !== \"object\") {\n        throw new Error(\n          `Invalid automation config: operations[${index}] is not an object`,\n        );\n      }\n      const opObj = op as Record<string, unknown>;\n      const operation = opObj.operation;\n      if (typeof operation !== \"string\" || operation.length === 0) {\n        throw new Error(\n          `Invalid automation config: operations[${index}].operation must be a non-empty string`,\n        );\n      }\n      const parameters = (opObj.parameters as Record<string, any>) || {};\n      if (!isToolIdInRegistry(operation, toolRegistry)) {\n        unresolved.push(operation);\n      }\n      return { operation, parameters };\n    },\n  );\n","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/core/utils/automationConverter.ts#L311-L347","documentation":"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.","triggerScenarios":"An operations entry is a bare string, number, or null rather than { operation, parameters }.","commonSituations":"Hand-edited JSON; a truncated export; a generator that emitted a flat array of operation names.","solutions":["Ensure each operations entry is an object.","Re-export the config.","Validate each element before mapping."],"exampleFix":"// before\nif (!op || typeof op !== 'object') throw new Error(`operations[${index}] is not an object`);\n\n// after\nconst valid = operations.every((o) => o && typeof o === 'object' && !Array.isArray(o));\nif (!valid) throw new Error('One or more operations are malformed.');","handlingStrategy":"validation","validationCode":"const bad = operations.findIndex((o) => !o || typeof o !== 'object' || Array.isArray(o));\nif (bad !== -1) throw new Error(`operations[${bad}] is not an object`);","typeGuard":"function isOperationEntry(o: unknown): o is Record<string, unknown> {\n  return !!o && typeof o === 'object' && !Array.isArray(o);\n}","tryCatchPattern":null,"preventionTips":["Schema-validate operation entries before processing.","Prefer re-exporting over hand-editing configs."],"tags":["automation","config","validation","json"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}