{"record":{"id":"431368e9dadb3a3a","repo":"Stirling-Tools/Stirling-PDF","slug":"invalid-folder-scanning-config-pipeline-index","errorCode":null,"errorMessage":"Invalid folder scanning config: pipeline[${index}] is not an object","messagePattern":"Invalid folder scanning config: pipeline\\[(.+?)\\] is not an object","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/editor/src/core/utils/automationConverter.ts","lineNumber":245,"sourceCode":"  automation: Omit<AutomationConfig, \"id\" | \"createdAt\" | \"updatedAt\">;\n  unresolvedOperations: string[];\n} {\n  if (!raw || typeof raw !== \"object\") {\n    throw new Error(\"Invalid folder scanning config: expected JSON object\");\n  }\n  const obj = raw as Record<string, unknown>;\n  const pipeline = obj.pipeline;\n  if (!Array.isArray(pipeline)) {\n    throw new Error(\"Invalid folder scanning config: missing 'pipeline' array\");\n  }\n\n  const endpointMap = buildEndpointToToolIdMap(toolRegistry);\n  const unresolved: string[] = [];\n\n  const operations: AutomationOperation[] = pipeline.map(\n    (step: unknown, index: number) => {\n      if (!step || typeof step !== \"object\") {\n        throw new Error(\n          `Invalid folder scanning config: pipeline[${index}] is not an object`,\n        );\n      }\n      const stepObj = step as Record<string, unknown>;\n      const rawOperation = stepObj.operation;\n      if (typeof rawOperation !== \"string\" || rawOperation.length === 0) {\n        throw new Error(\n          `Invalid folder scanning config: pipeline[${index}].operation must be a non-empty string`,\n        );\n      }\n      const rawParameters = (stepObj.parameters as Record<string, any>) || {};\n      // Strip the export-time marker so the imported automation runs cleanly.\n      const { fileInput: _fileInput, ...parameters } = rawParameters;\n\n      // 1) Direct frontend-tool-id match (handles the converter's fallback when\n      //    no endpoint could be resolved at export time).\n      if (isToolIdInRegistry(rawOperation, toolRegistry)) {\n        return { operation: rawOperation, parameters };","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/core/utils/automationConverter.ts#L227-L263","documentation":"Thrown when an element of the pipeline array is null or not an object (e.g. a bare string or number). Each pipeline step must be an object with operation and parameters.","triggerScenarios":"A pipeline entry is a bare string, number, or null rather than { operation, parameters }.","commonSituations":"Hand-edited JSON where a step is just an operation name; a truncated export; a generator that emitted a flat array of operation strings.","solutions":["Ensure each pipeline entry is an object { operation, parameters }.","Re-export from the Automate tool to regenerate well-formed steps.","Validate each element before mapping."],"exampleFix":"// before\nif (!step || typeof step !== 'object') throw new Error(`pipeline[${index}] is not an object`);\n\n// after\nconst valid = pipeline.every((s) => s && typeof s === 'object' && !Array.isArray(s));\nif (!valid) throw new Error('One or more pipeline steps are malformed.');","handlingStrategy":"validation","validationCode":"const bad = pipeline.findIndex((s) => !s || typeof s !== 'object' || Array.isArray(s));\nif (bad !== -1) throw new Error(`pipeline[${bad}] is not an object`);","typeGuard":"function isPipelineStep(s: unknown): s is Record<string, unknown> {\n  return !!s && typeof s === 'object' && !Array.isArray(s);\n}","tryCatchPattern":null,"preventionTips":["Validate pipeline elements with a schema/type-guard before processing.","Prefer re-exporting configs over hand-editing them."],"tags":["automation","config","validation","json","folder-scanning"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}