iflytek/astron-agent · error · ValueError
Invalid RagTypeEnum value
Error message
Invalid RagTypeEnum value: {item} What it means
The knowledge-pro node's rag_type mapping function converts a RagTypeEnum value into its implementation name (e.g. 'DeepSearch', 'LongRAG'). It raises ValueError when the supplied item is not a key in the v_map, i.e. the enum value is not one of AGENTIC_RAG or LONG_RAG (note AGENTIC_RAG's alternative 'R2RAG' implementation is commented out).
Solutions
- Set the knowledge-pro node's rag_type to a supported value: AGENTIC_RAG or LONG_RAG
- If a new enum value is required, add an entry to the v_map in the rag_type mapping function
- Check that the workflow definition JSON was not produced by an incompatible version of the platform
Example fix
// before "rag_type": "cbg_rag" # in workflow node config -> Invalid RagTypeEnum value // after "rag_type": "agentic_rag"
Defensive patterns
Strategy: validation
Validate before calling
from core.workflow.engine.nodes.knowledge_pro.consts import RagTypeEnum
ALLOWED = {RagTypeEnum.AGENTIC_RAG.value, RagTypeEnum.LONG_RAG.value}
if rag_type_value not in ALLOWED:
raise ValueError(f"rag_type must be one of {sorted(ALLOWED)}, got {rag_type_value!r}") Type guard
def is_supported_rag_type(v: str) -> bool:
return v in {RagTypeEnum.AGENTIC_RAG.value, RagTypeEnum.LONG_RAG.value} Prevention
- Keep RagTypeEnum members and the v_map in consts.py in sync whenever adding a new rag type
- Validate the workflow DSL against the current enum before execution
- Pin workflow exports to compatible platform versions
When it happens
Trigger: The node's rag_type config resolves to a RagTypeEnum member other than AGENTIC_RAG or LONG_RAG (e.g. CBG_RAG or any newly added enum member not yet mapped in v_map), then the rag_type-to-implementation lookup is called.
Common situations: Workflow DSL exported from a newer/older version references a RagTypeEnum value this build doesn't map; a user selects a rag type in the console UI that the knowledge-pro node doesn't support; a new enum member was added to RagTypeEnum without updating v_map.
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
- MCP_ERROR
- APP_NOT_FOUND_ERROR
- CODE_EXEC_TIMEOUT_SEC must be between
- CODE_EXECUTION_ERROR
- ENG_PROTOCOL_VALIDATE_ERROR
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/594a2664ba316f7a.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/nodes/knowledge_pro/consts.py:36
AGENTIC_RAG = 1 # Agent-based RAG with deep search capabilities
LONG_RAG = 2 # Long context RAG for extended document processing
@staticmethod
def getitem(item: int) -> str:
"""
Get the string representation of a RAG type enum value.
:param item: The integer value of the RAG type enum
:return: The corresponding string representation
:raises ValueError: If the provided item value is not valid
"""
v_map = {
RagTypeEnum.AGENTIC_RAG.value: "DeepSearch",
# RagTypeEnum.AGENTIC_RAG.value: "R2RAG", # Alternative implementation (commented)
RagTypeEnum.LONG_RAG.value: "LongRAG",
}
if item not in v_map:
raise ValueError(f"Invalid RagTypeEnum value: {item}")
return v_map[item]
class RepoTypeEnum(Enum):
"""
Enumeration for repository types in knowledge base operations.
Defines the different types of knowledge repositories that can be used
for document retrieval and processing.
"""
AIUI_RAG2 = 1 # AIUI RAG version 2 repository
CBG_RAG = 2 # CBG (Content-Based Generation) RAG repository
@staticmethod
def getitem(item: int) -> str:
"""
Get the string representation of a repository type enum value.View on GitHub (pinned to 5e758547a8)