MCPcopy
hub / github.com/codeaashu/claude-code / renderToolUseErrorMessage

Function renderToolUseErrorMessage

src/tools/FileEditTool/UI.tsx:128–154  ·  view source on GitHub ↗
(result: ToolResultBlockParam['content'], options: {
  progressMessagesForMessage: ProgressMessage[];
  tools: Tools;
  verbose: boolean;
})

Source from the content-addressed store, hash-verified

126 return <EditRejectionDiff filePath={filePath} oldString={oldString} newString={newString} replaceAll={replaceAll} style={style} verbose={verbose} />;
127}
128export function renderToolUseErrorMessage(result: ToolResultBlockParam['content'], options: {
129 progressMessagesForMessage: ProgressMessage[];
130 tools: Tools;
131 verbose: boolean;
132}): React.ReactElement {
133 const {
134 verbose
135 } = options;
136 if (!verbose && typeof result === 'string' && extractTag(result, 'tool_use_error')) {
137 const errorMessage = extractTag(result, 'tool_use_error');
138 // Show a less scary message for intended behavior
139 if (errorMessage?.includes('File has not been read yet')) {
140 return <MessageResponse>
141 <Text dimColor>File must be read first</Text>
142 </MessageResponse>;
143 }
144 if (errorMessage?.includes(FILE_NOT_FOUND_CWD_NOTE)) {
145 return <MessageResponse>
146 <Text color="error">File not found</Text>
147 </MessageResponse>;
148 }
149 return <MessageResponse>
150 <Text color="error">Error editing file</Text>
151 </MessageResponse>;
152 }
153 return <FallbackToolUseErrorMessage result={result} verbose={verbose} />;
154}
155type RejectionDiffData = {
156 patch: StructuredPatchHunk[];
157 firstLine: string | null;

Callers

nothing calls this directly

Calls 1

extractTagFunction · 0.85

Tested by

no test coverage detected