{"record":{"id":"594a2664ba316f7a","repo":"iflytek/astron-agent","slug":"invalid-ragtypeenum-value-item","errorCode":null,"errorMessage":"Invalid RagTypeEnum value: {item}","messagePattern":"Invalid RagTypeEnum value: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/knowledge_pro/consts.py","lineNumber":36,"sourceCode":"    AGENTIC_RAG = 1  # Agent-based RAG with deep search capabilities\n    LONG_RAG = 2  # Long context RAG for extended document processing\n\n    @staticmethod\n    def getitem(item: int) -> str:\n        \"\"\"\n        Get the string representation of a RAG type enum value.\n\n        :param item: The integer value of the RAG type enum\n        :return: The corresponding string representation\n        :raises ValueError: If the provided item value is not valid\n        \"\"\"\n        v_map = {\n            RagTypeEnum.AGENTIC_RAG.value: \"DeepSearch\",\n            # RagTypeEnum.AGENTIC_RAG.value: \"R2RAG\",  # Alternative implementation (commented)\n            RagTypeEnum.LONG_RAG.value: \"LongRAG\",\n        }\n        if item not in v_map:\n            raise ValueError(f\"Invalid RagTypeEnum value: {item}\")\n        return v_map[item]\n\n\nclass RepoTypeEnum(Enum):\n    \"\"\"\n    Enumeration for repository types in knowledge base operations.\n\n    Defines the different types of knowledge repositories that can be used\n    for document retrieval and processing.\n    \"\"\"\n\n    AIUI_RAG2 = 1  # AIUI RAG version 2 repository\n    CBG_RAG = 2  # CBG (Content-Based Generation) RAG repository\n\n    @staticmethod\n    def getitem(item: int) -> str:\n        \"\"\"\n        Get the string representation of a repository type enum value.","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/knowledge_pro/consts.py#L18-L54","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n\"rag_type\": \"cbg_rag\"  # in workflow node config -> Invalid RagTypeEnum value\n// after\n\"rag_type\": \"agentic_rag\"","handlingStrategy":"validation","validationCode":"from core.workflow.engine.nodes.knowledge_pro.consts import RagTypeEnum\nALLOWED = {RagTypeEnum.AGENTIC_RAG.value, RagTypeEnum.LONG_RAG.value}\nif rag_type_value not in ALLOWED:\n    raise ValueError(f\"rag_type must be one of {sorted(ALLOWED)}, got {rag_type_value!r}\")","typeGuard":"def is_supported_rag_type(v: str) -> bool:\n    return v in {RagTypeEnum.AGENTIC_RAG.value, RagTypeEnum.LONG_RAG.value}","tryCatchPattern":null,"preventionTips":["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"],"tags":["python","enum","config","workflow"],"backgroundTag":"invalid-enum-value","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}