Skip to content

Native file tools: include the attempted path and operation in filesystem errors #183

Closed

Description

@yxlyx

Motivation

Native file-tool failures can surface only as error: FileNotFound, omitting the tool, supplied path, and failed operation. This prevents users and agents from distinguishing a missing read/edit target from a missing parent directory during file creation.

Current behavior / evidence

The outer dispatcher formats propagated failures generically:

Affected operation sites include:

Proposed behavior

Map expected filesystem failures at the operation site, where the tool, supplied path, and semantic operation are known.

At minimum:

  • read_file reports that its target could not be opened/read;
  • edit_file reports that its target could not be opened for editing and suggests write_file if creation was intended;
  • write_file identifies a missing parent component rather than implying that a new output file must already exist.

Preserve more-specific confinement, symlink, permission, and validation errors.

Acceptance criteria

  • Missing-target errors from read_file and edit_file identify the tool, supplied path, and operation.
  • write_file distinguishes a missing parent directory from a valid nonexistent output target.
  • The underlying error category remains available.
  • Results remain marked is_error = true.
  • Existing cwd-confinement and symlink-escape diagnostics retain precedence.
  • Existing argument, binary-file, range, and old_string diagnostics are unchanged.
  • Diagnostics do not expose unrelated host paths or secrets.
  • Regression tests cover a missing read target, missing edit target, missing write parent, and successful new-file creation.

Related issues

Activity

  1. added a commit that references this issue on Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions