Mintplex-Labs/anything-llm · error · Error

Unknown flow type

Error message

Unknown flow type: ${step.type}

What it means

Thrown by FlowExecutor.executeStep when a flow step's `type` matches no case in its dispatch switch (comment/variable echo, API_CALL, LLM_INSTRUCTION, WEB_SCRAPING). The FLOW_TYPES set compiled into this build is the source of truth, so a JSON flow file containing a step type this instance doesn't know (or that isn't offered on this platform, e.g. file-write/code-execution blocks on Docker) aborts execution mid-flow.

Solutions

  1. Open the flow JSON under storage/plugins/agent-flows/<uuid>.json and remove or rewrite the offending step to a supported type (api_call, llm_instruction, web_scraping, comment/variable steps).
  2. Rebuild the flow in the UI flow builder — its palette only offers blocks this platform supports.
  3. Match AnythingLLM versions between the instance that exported the flow and the one importing it.
  4. Compare step.type values against Object.values(FLOW_TYPES) from server/utils/agentFlows/flowTypes.js for your build.

Example fix

// before: storage/plugins/agent-flows/<uuid>.json
"steps": [
  { "type": "file_write", "config": { "path": "out.txt" } }
]
// -> Error: Unknown flow type: file_write

// after
"steps": [
  { "type": "api_call", "config": { "url": "https://example.com/hook" } }
]
Defensive patterns

Strategy: try-catch

Validate before calling

const { FLOW_TYPES } = require("../utils/agentFlows/executor");

function flowStepsSupported(flow) {
  const supported = Object.values(FLOW_TYPES).map((d) => d.type);
  return flow.config.steps.every((s) => supported.includes(s.type));
}

Try / catch

try {
  await AgentFlows.executeFlow(uuid, variables, aibitat);
} catch (e) {
  if (/^Unknown flow type:/.test(e.message)) {
    // strip or rebuild the offending step, then re-save the flow
    return respondFlowUnsupported(e.message);
  }
  throw e;
}

Prevention

When it happens

Trigger: Executing a flow whose steps array contains any type outside this build's FLOW_TYPES: hand-edited flow JSON in storage/plugins/agent-flows, a flow exported from a newer AnythingLLM or the Desktop edition and imported here, or a step whose `type` key was renamed/mistyped.

Common situations: Importing Desktop flows (which may include code/file blocks) into the Docker deployment; downgrading AnythingLLM while keeping old flow files; manually authoring flow JSON with a guessed type like "http_request" instead of "api_call"; sharing flow files between instances of different versions.

Related errors


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

Appendix: source

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

          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 f92433b4ea)