diff --git a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py index ea370c908b9844..e9aa65540117df 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py +++ b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py @@ -49,6 +49,12 @@ def _run(self, variable_pool: VariablePool) -> NodeRunResult: variables = { 'query': query } + if not query: + return NodeRunResult( + status=WorkflowNodeExecutionStatus.FAILED, + inputs=variables, + error="Query is required." + ) # retrieve knowledge try: results = self._fetch_dataset_retriever(