Mintplex-Labs/anything-llm · error · Error

Unknown flow type: ${step.type}

Error message

Unknown flow type: ${step.type}

What it means

Thrown by FlowExecutor.executeStep() when a flow step's `type` does not match any case in its switch (start, apiCall, llmInstruction, webScraping). The executor only knows the four FLOW_TYPES it imports from flowTypes.js. This protects against executing a block the runtime cannot handle. Note that AgentFlows.saveFlow() (error 387) validates this at save time, so reaching this throw means the flow file was written bypassing saveFlow (hand-edited, migrated, or created by a newer build).

Source

Thrown at server/utils/agentFlows/executor.js:168

          config.variables.forEach((v) => {
            if (v.name && !this.variables[v.name]) {
              this.variables[v.name] = v.value || "";
            }
          });
        }
        result = this.variables;
        break;
      case FLOW_TYPES.API_CALL.type:
        result = await executeApiCall(config, context);
        break;
      case FLOW_TYPES.LLM_INSTRUCTION.type:
        result = await executeLLMInstruction(config, context);
        break;
      case FLOW_TYPES.WEB_SCRAPING.type:
        result = await executeWebScraping(config, context);
        break;
      default:
        throw new Error(`Unknown flow type: ${step.type}`);
    }

    // Store result in variable if specified
    if (config.resultVariable || config.responseVariable) {
      const varName = config.resultVariable || config.responseVariable;
      this.variables[varName] = result;
    }

    // If directOutput is true, mark this result for direct output
    if (config.directOutput) result = { directOutput: true, result };
    return result;
  }

  /**
   * Execute entire flow
   * @param {Object} flow - The flow to execute
   * @param {Object} initialVariables - Initial variables for the flow
   * @param {Object} aibitat - The aibitat instance from the agent handler

View on GitHub (pinned to 526360e320)

Solutions

  1. Inspect the offending flow JSON under STORAGE_DIR/plugins/agent-flows and find the step whose `type` is not start/apiCall/llmInstruction/webScraping.
  2. Remove or replace the unsupported step, then re-save the flow through the UI so saveFlow() re-validates all step types.
  3. If the block type is valid for your setup, upgrade AnythingLLM to a version whose executor.js handles that type.
  4. If migrating between platforms (Desktop to Docker), recreate the flow on the target platform instead of copying the JSON.

Example fix

// before - flow JSON contains an unknown block
{"steps":[{"type":"codeExecution","config":{...}}]}
// after - remove the unsupported step or replace with a supported type
{"steps":[{"type":"llmInstruction","config":{"instruction":"..."}}]}
Defensive patterns

Strategy: validation

Validate before calling

const { FLOW_TYPES } = require("./flowTypes");
const SUPPORTED = Object.values(FLOW_TYPES).map((d) => d.type);
function validateFlowSteps(flow) {
  const bad = (flow.config.steps || []).filter(
    (s) => !SUPPORTED.includes(s.type)
  );
  if (bad.length) throw new Error(`Unsupported step types: ${bad.map((s) => s.type).join(", ")}`);
}

Type guard

const SUPPORTED_TYPES = new Set(Object.values(FLOW_TYPES).map((d) => d.type));
const isSupportedStep = (step) =>
  step && typeof step.type === "string" && SUPPORTED_TYPES.has(step.type);

Try / catch

try {
  await executor.executeStep(step);
} catch (e) {
  if (e.message.startsWith("Unknown flow type")) {
    // skip or log the unsupported step rather than aborting the whole flow
  } else throw e;
}

Prevention

When it happens

Trigger: Calling FlowExecutor.executeStep() with a step object whose `.type` is a string other than "start", "apiCall", "llmInstruction", or "webScraping". This includes a step.type of undefined (missing field), a renamed type, or a future type such as a code-execution or file-writing block that this build does not register.

Common situations: A flow JSON edited directly on disk in storage/plugins/agent-flows; a flow exported from a newer AnythingLLM version containing block types the older executor does not recognize; a corrupt/partially-written flow file where step.type is missing.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/3050c4ac05d72806. Report an issue: GitHub.