Stirling-Tools/Stirling-PDF · warning · Error

Invalid folder scanning config: pipeline[${index}] is not an

Error message

Invalid folder scanning config: pipeline[${index}] is not an object

What it means

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.

Source

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

  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`,
        );
      }
      const rawParameters = (stepObj.parameters as Record<string, any>) || {};
      // Strip the export-time marker so the imported automation runs cleanly.
      const { fileInput: _fileInput, ...parameters } = rawParameters;

      // 1) Direct frontend-tool-id match (handles the converter's fallback when
      //    no endpoint could be resolved at export time).
      if (isToolIdInRegistry(rawOperation, toolRegistry)) {
        return { operation: rawOperation, parameters };

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Ensure each pipeline entry is an object { operation, parameters }.
  2. Re-export from the Automate tool to regenerate well-formed steps.
  3. Validate each element before mapping.

Example fix

// before
if (!step || typeof step !== 'object') throw new Error(`pipeline[${index}] is not an object`);

// after
const valid = pipeline.every((s) => s && typeof s === 'object' && !Array.isArray(s));
if (!valid) throw new Error('One or more pipeline steps are malformed.');
Defensive patterns

Strategy: validation

Validate before calling

const bad = pipeline.findIndex((s) => !s || typeof s !== 'object' || Array.isArray(s));
if (bad !== -1) throw new Error(`pipeline[${bad}] is not an object`);

Type guard

function isPipelineStep(s: unknown): s is Record<string, unknown> {
  return !!s && typeof s === 'object' && !Array.isArray(s);
}

Prevention

When it happens

Trigger: A pipeline entry is a bare string, number, or null rather than { operation, parameters }.

Common situations: Hand-edited JSON where a step is just an operation name; a truncated export; a generator that emitted a flat array of operation strings.

Related errors


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