diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index b1f07f42ea..0a04c1ada3 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1088,7 +1088,27 @@ export const ChatRowContent = ({ /> ) - case "error": + case "error": { + // Extract error title from the message text if it follows the pattern "Title: rest of message" + let errorTitle = t("chat:error") + const errorContent = message.text || "" + + // Check if the error message starts with a title pattern (e.g., "File Not Found:", "Permission Denied:", etc.) + // Look for text before the first colon on the first line + const firstLineEnd = errorContent.indexOf("\n") + const firstLine = firstLineEnd > -1 ? errorContent.substring(0, firstLineEnd) : errorContent + const colonIndex = firstLine.indexOf(":") + + if (colonIndex > 0 && colonIndex < 50) { + // Reasonable title length limit + // Extract the title part before the colon + const potentialTitle = firstLine.substring(0, colonIndex).trim() + // Use it as title if it's not too long and looks like a title + if (potentialTitle.length > 0) { + errorTitle = potentialTitle.replace(/^Error\s+/i, "").trim() + } + } + return (
- {message.text} + {errorContent}