OpenBMB/ChatDev · error · ValueError

Node {node.id} missing loop_counter configuration

Error message

Node {node.id} missing loop_counter configuration

What it means

LoopCounterNodeExecutor requires a LoopCounterConfig on the node; as_config returned None so it cannot read counter settings (thresholds, reset behavior).

Source

Thrown at runtime/node/executor/loop_counter_executor.py:19

"""Loop counter guard node executor."""

from typing import List, Dict, Any

from entity.configs import Node
from entity.configs.node.loop_counter import LoopCounterConfig
from entity.messages import Message, MessageRole
from runtime.node.executor.base import NodeExecutor


class LoopCounterNodeExecutor(NodeExecutor):
    """Track loop iterations and emit output only after hitting the limit."""

    STATE_KEY = "loop_counter"

    def execute(self, node: Node, inputs: List[Message]) -> List[Message]:
        config = node.as_config(LoopCounterConfig)
        if config is None:
            raise ValueError(f"Node {node.id} missing loop_counter configuration")

        state = self._get_state()
        counter = state.setdefault(node.id, {"count": 0})
        counter["count"] += 1
        count = counter["count"]

        if count < config.max_iterations:
            self.log_manager.debug(
                f"LoopCounter {node.id}: iteration {count}/{config.max_iterations} (suppress downstream)"
            )
            return []

        if config.reset_on_emit:
            counter["count"] = 0

        content = config.message or f"Loop limit reached ({config.max_iterations})"
        metadata = {
            "loop_counter": {

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Attach a LoopCounterConfig to the node's config
  2. Validate all nodes have configs matching their type before running the workflow
  3. Re-serialize workflows with current tooling after upgrades

Example fix

# before
Node(id='c1', node_type='loop_counter')

# after
Node(id='c1', node_type='loop_counter', config={'max_iterations': 5})
Defensive patterns

Strategy: validation

Validate before calling

assert node.as_config(LoopCounterConfig) is not None

Prevention

When it happens

Trigger: Executing a node assumed to be a loop counter without a LoopCounterConfig payload in its config dict.

Common situations: Workflow JSON missing the config block; config keys renamed between runtime versions; constructing loop-counter nodes manually in tests.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/90c6ebe469d44431. Report an issue: GitHub.