RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: The separator line causes the font size of the agent message error text to be too large. (#20462)
balibabu0343c7ccb433
diff --git a/internal/agent/canvas/run_error.go b/internal/agent/canvas/run_error.goindex 8fa2e365a4..bf18965832 100644--- a/internal/agent/canvas/run_error.go+++ b/internal/agent/canvas/run_error.go@@ -63,5 +63,5 @@ func runErrorEvent(err error) ErrorEvent {Kind: RunErrorKindInternal,}}- return ErrorEvent{Message: err.Error()}+ return ErrorEvent{Message: runtime.MarkdownSafeErrorText(err)}}diff --git a/internal/agent/canvas/run_error_test.go b/internal/agent/canvas/run_error_test.goindex 8e9a76f2d4..8568014315 100644--- a/internal/agent/canvas/run_error_test.go+++ b/internal/agent/canvas/run_error_test.go@@ -81,3 +81,19 @@ func TestRunErrorEventPreservesUserFacingMessage(t *testing.T) {t.Errorf("kind = %q, want user", payload.Kind)}}++func TestRunErrorEventNeutralizesEinoNodePathSeparator(t *testing.T) {+ // eino's internalError.Error() decorates node failures with a dash-only+ // line, which Markdown clients parse as a setext heading underline.+ einoText := "[NodeRunError] agent: component \"Retrieval:SweetDogsAct\" invoke: aliyun rerank API error: 404 Not Found" ++ "\n------------------------\nnode path: [Retrieval:SweetDogsAct]"+ payload := runErrorEvent(fmt.Errorf("agent invoke: %w", errors.New(einoText)))+ if strings.Contains(payload.Message, "------------------------") {+ t.Fatalf("message still carries the setext heading separator: %q", payload.Message)+ }+ want := "agent invoke: [NodeRunError] agent: component \"Retrieval:SweetDogsAct\" invoke: aliyun rerank API error: 404 Not Found" ++ "\n\nnode path: [Retrieval:SweetDogsAct]"+ if payload.Message != want {+ t.Errorf("message = %q, want %q", payload.Message, want)+ }+}diff --git a/internal/agent/component/agent.go b/internal/agent/component/agent.goindex bfb4f0c3e1..d0fd1cf479 100644--- a/internal/agent/component/agent.go+++ b/internal/agent/component/agent.go@@ -990,7 +990,7 @@ func (c *AgentComponent) invokeNow(ctx context.Context, db *gorm.DB, inputs map[if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || !isAgentGraphRunError(err) {return nil, fmt.Errorf("component: Agent.Invoke: %w", err)}- return map[string]any{"_ERROR": "**ERROR**: " + err.Error()}, nil+ return map[string]any{"_ERROR": "**ERROR**: " + runtime.MarkdownSafeErrorText(err)}, nil}// Post-stream citation grounding. When Cite is enabled and// the canvas state has recorded retrieval chunks (populateddiff --git a/internal/agent/runtime/component.go b/internal/agent/runtime/component.goindex 91b137d400..e768df91ab 100644--- a/internal/agent/runtime/component.go+++ b/internal/agent/runtime/component.go@@ -32,6 +32,7 @@ package runtimeimport ("context""fmt"+ "strings""sync""gorm.io/gorm"@@ -99,6 +100,26 @@ func (e *DeferredStreamError) FailureText() string {return e.Text}+// einoNodePathSeparator is the decoration eino's internalError.Error()+// inserts between the wrapped cause and its node-path diagnostic:+//+// [NodeRunError] <cause>+// ------------------------+// node path: [...]+//+// A dash-only line directly under a paragraph is valid Markdown setext+// heading syntax, so chat clients render the whole error block as an <h2>.+// Swap it for a blank line: the node path stays visible as an ordinary+// paragraph while the error renders in the normal body font.+const einoNodePathSeparator = "\n------------------------\n"++// MarkdownSafeErrorText returns err's text with eino's node-path separator+// neutralized, so error text surfaced into Markdown-rendered chat messages+// keeps body formatting instead of turning into a heading.+func MarkdownSafeErrorText(err error) string {+ return strings.ReplaceAll(err.Error(), einoNodePathSeparator, "\n\n")+}+// ParamError wraps a parameter validation failure with the field name// for clearer error messages to the user.type ParamError struct {