iflytek/astron-agent · error · ValueError

invalid node type value

Error message

invalid node type value {value}

What it means

NodeType.value_of converts a raw string into a NodeType enum and raises ValueError('invalid node type value {value}') when no enum member matches. This guard exists so that DSL node dicts containing unknown node types fail fast instead of silently producing unhandled node behavior downstream.

Solutions

  1. Fix the node's type value in the DSL to a NodeType member supported by this engine version
  2. Upgrade the workflow engine to a version whose NodeType enum includes the node type used
  3. Add any custom node types to the NodeType enum or register them via the extension mechanism before parsing
  4. Lint the DSL against the engine's supported node types before import

Example fix

# before
"type": "llmNode"  # unknown casing
# after
"type": "llm"
Defensive patterns

Strategy: validation

Validate before calling

from core.workflow.engine.entities.node_entities import NodeType
valid = {t.value for t in NodeType}
for n in dsl["nodes"]:
    assert n.get("type") in valid, f"unknown node type {n.get('type')}"

Type guard

def is_known_node_type(value) -> bool:
    try:
        NodeType.value_of(value)
        return True
    except ValueError:
        return False

Try / catch

try:
    nt = NodeType.value_of(raw_type)
except ValueError as e:
    log.error("unsupported node type in DSL: %s", raw_type)
    raise DslImportError(str(e)) from e

Prevention

When it happens

Trigger: Parsing a DSL whose node has a 'type' value not present in the NodeType enum — custom/unknown types, typos, node types from a newer engine version loaded in an older one, or plugin node types not registered in the enum.

Common situations: Version skew: DSL exported from a newer release with new node types imported into an older engine; hand-edited type strings with wrong casing; third-party DSL generators emitting non-standard types.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/4ae9223053c63430. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/entities/node_entities.py:51

    DATABASE = "database"
    RPA = "rpa"
    MCP = "mcp"
    MEMORY_ADD = "memory-add"
    MEMORY_SEARCH = "memory-search"

    @classmethod
    def value_of(cls, value: str) -> "NodeType":
        """
        Get NodeType enum from string value.

        :param value: Node type string value
        :return: Corresponding NodeType enum
        :raises ValueError: If the value is not a valid node type
        """
        for node_type in cls:
            if node_type.value == value:
                return node_type
        raise ValueError(f"invalid node type value {value}")


class SystemVariable(Enum):
    """
    Enumeration of system variables available in the workflow.
    """

    QUERY = "query"
    FILES = "files"
    CONVERSATION_ID = "conversation_id"
    USER_ID = "user_id"

    @classmethod
    def value_of(cls, value: str) -> "SystemVariable":
        """
        Get SystemVariable enum from string value.

        :param value: System variable string value

View on GitHub (pinned to 5e758547a8)