Stirling-Tools/Stirling-PDF · warning · Error

Invalid folder scanning config: missing 'pipeline' array

Error message

Invalid folder scanning config: missing 'pipeline' array

What it means

Thrown by parseFolderScanningConfig when the value is an object but obj.pipeline is not an array. The folder-scanning format requires a top-level pipeline array.

Source

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

 * Parse a folder-scanning pipeline JSON into the native AutomationConfig
 * shape. Endpoint paths are reverse-mapped to frontend tool IDs via the
 * supplied registry; unmappable operations are kept verbatim and reported in
 * `unresolvedOperations`.
 */
export function parseFolderScanningConfig(
  raw: unknown,
  toolRegistry: Partial<ToolRegistry>,
): {
  automation: Omit<AutomationConfig, "id" | "createdAt" | "updatedAt">;
  unresolvedOperations: string[];
} {
  if (!raw || typeof raw !== "object") {
    throw new Error("Invalid folder scanning config: expected JSON object");
  }
  const obj = raw as Record<string, unknown>;
  const pipeline = obj.pipeline;
  if (!Array.isArray(pipeline)) {
    throw new Error("Invalid folder scanning config: missing 'pipeline' array");
  }

  const endpointMap = buildEndpointToToolIdMap(toolRegistry);
  const unresolved: string[] = [];

  const operations: AutomationOperation[] = pipeline.map(
    (step: unknown, index: number) => {
      if (!step || typeof step !== "object") {
        throw new Error(
          `Invalid folder scanning config: pipeline[${index}] is not an object`,
        );
      }
      const stepObj = step as Record<string, unknown>;
      const rawOperation = stepObj.operation;
      if (typeof rawOperation !== "string" || rawOperation.length === 0) {
        throw new Error(
          `Invalid folder scanning config: pipeline[${index}].operation must be a non-empty string`,
        );

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Confirm the file has a top-level "pipeline": [...] array.
  2. Use auto-detect (omit expectedFormat) so the correct parser is chosen.
  3. Re-export the config from the Automate tool.

Example fix

// before
const pipeline = obj.pipeline;
if (!Array.isArray(pipeline)) throw new Error('missing pipeline array');

// after
if (detectAutomationFormat(raw) !== 'folderScanning') {
  throw new Error('This file is not a folder-scanning config.');
}
Defensive patterns

Strategy: validation

Validate before calling

if (detectAutomationFormat(raw) !== 'folderScanning') {
  throw new Error('File is not folder-scanning format (no pipeline array).');
}

Type guard

function hasPipelineArray(raw: unknown): boolean {
  return !!raw && typeof raw === 'object' && !Array.isArray(raw)
    && Array.isArray((raw as any).pipeline);
}

Prevention

When it happens

Trigger: The object has no pipeline key, pipeline is an object/string instead of an array, or an Automate-format file (operations[]) was parsed as folder-scanning.

Common situations: User hand-edited the export and renamed/removed pipeline; importing an Automate JSON as folder-scanning; a typo in the key.

Related errors


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