Skip to content

write and edit tools return spurious 'cmd must not be empty' error despite successful operations #2255

Closed

Description

@smantzavinos

Environment

  • OS: NixOS
  • Tool: OpenCode CLI (Claude Code)
  • Affected Tools: write and edit
  • Error: TypeError [ERR_INVALID_ARG_TYPE]: cmd must not be empty

Problem Description

Both write and edit tools consistently return a TypeError [ERR_INVALID_ARG_TYPE]: cmd must not be empty error message, but the actual file operations succeed correctly. This creates confusion as the error suggests failure when operations actually work.

Reproduction Steps

  1. Use write tool to create a new file
  2. Use edit tool to modify an existing file
  3. Both operations return the error but successfully perform the intended file operations

Expected Behavior

Tools should complete successfully without error messages when operations succeed.

Actual Behavior

  • Operations succeed (files are created/modified correctly)
  • Error message appears: TypeError [ERR_INVALID_ARG_TYPE]: cmd must not be empty
  • Creates confusion about operation success/failure

Evidence

write tool: Creates file successfully + shows error
edit tool: Modifies file successfully + shows error
File verification: All changes applied correctly

Example Output

> write tool call to create test_file.md
TypeError [ERR_INVALID_ARG_TYPE]: cmd must not be empty

> read test_file.md
File exists with correct content - operation actually succeeded

Hypothesis

Tools may be internally executing empty commands for validation/verification while the actual file operations use direct filesystem APIs.

Impact

  • Misleading error reporting
  • Confusion about operation success
  • Potential automation issues if error handling relies on tool return codes

Activity

  1. github-actions commented on Aug 26, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The symptoms in #1090 are particularly similar - successful file operations accompanied by spurious error messages. Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Aug 26, 2025

    @rekram1-node
    Collaborator

    @smantzavinos does this only happen when working with certain files or is this a constant thing? What kind of project is this?

  3. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Collaborator

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions