Tools reference changedtools-reference
Nearest release: v2.1.334, published 5 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 2 Dec 2026 00:41 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 2 Dec 2026 01:07 UTC.
Upstream edited
Recorded here
Lines+5added
Lines−7removed
From line
274
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits113to this page, all time
The whole hunk
from line 274, old and new numbered
/
from line 274
274274
275275### Non-UTF-8 files
276276
277Claude can't use [NotebookEdit](#notebookedit-tool-behavior) on a file that isn't valid UTF-8. The same goes for Edit, unless the file starts with a little-endian UTF-16 byte-order mark. When Claude tries, the tool refuses the change and leaves the file untouched. Refused files include non-ASCII text saved in a legacy encoding such as Windows-1252 or Shift-JIS, binary files, and UTF-8 with an invalid byte sequence.
277The Edit, Write, and [NotebookEdit](#notebookedit-tool-behavior) tools refuse to change a file that isn't valid UTF-8 and lacks a little-endian UTF-16 byte-order mark. Refused files include non-ASCII text saved in a legacy encoding such as Windows-1252 or Shift-JIS, binary files, and UTF-8 with an invalid byte sequence.
278278
279The tools refuse because they save the whole file back as UTF-8, which would replace every byte they can't decode with the replacement character `U+FFFD`. Instead, the [error Claude receives](https://code.claude.com/docs/en/errors.md#file-is-not-valid-utf-8) tells it to make the change with a shell command that keeps the file's encoding, or to ask you about converting it to UTF-8 first.
279The [error message](https://code.claude.com/docs/en/errors.md#file-is-not-valid-utf-8) tells Claude to make the change with a shell command that keeps the file's encoding, or to ask you about converting the file to UTF-8 first. Claude can still replace a refused file by deleting it and creating it again with Write. The new file is UTF-8, so the original encoding is lost.
280280
281Claude can still replace such a file with Write, unless the new content contains `U+FFFD`, the character Read shows Claude in place of bytes it can't decode. That guard stops Claude from writing back the garbled text it read. When Write does replace the file, it saves the new content as UTF-8, so the file's original encoding is lost.
282
283281## EndConversation tool behavior
284282
285283The EndConversation tool ends the current session. Claude uses it only in two situations:
from line 450
452450* `insert`: add a new cell after the target. With no `cell_id`, the new cell goes at the start of the notebook. Requires `cell_type` set to `code` or `markdown`.
453451* `delete`: remove the target cell.
454452
455NotebookEdit refuses a notebook file that doesn't decode as UTF-8, under the [same rule as Edit](#non-utf-8-files), and writes nothing.
453NotebookEdit refuses to change some [non-UTF-8 files](#non-utf-8-files), such as a Windows-1252 notebook.
456454
457455Permission rules use the `Edit(...)` path format. A rule like `Edit(notebooks/**)` covers NotebookEdit calls on files in that directory.
458456
from line 820
822820
823821## Write tool behavior
824822
825The Write tool creates a new file or overwrites an existing one with the full content provided. It doesn't append or merge. Write also overwrites an existing file whose bytes don't decode and saves the new content as UTF-8, as described under [non-UTF-8 files](#non-utf-8-files).
823The Write tool creates a new file or overwrites an existing one with the full content provided. Write refuses to overwrite some [non-UTF-8 files](#non-utf-8-files), such as Shift-JIS text.
826824
827825Whether Claude must read an existing file in the current conversation before overwriting it depends on the model and the file:
828826
No line in this hunk matches that.