Skip to content

ACP writeTextFile fails with "invalid path" when target file does not exist #2294

@yiliang114

Description

@yiliang114

What happened?

Image Image

When using ACP's writeTextFile to write to a file path that does not yet exist (i.e., creating a new file), the operation fails with an "invalid path" error instead of creating the file.

The CLI sends a writeTextFile request via ACP protocol to the IDE companion. If the target file does not exist on disk, the request is rejected with an error containing "invalid path" in the data or message field, preventing new file creation.

This means ACP writeTextFile can only overwrite existing files but cannot create new ones.

What did you expect to happen?

writeTextFile should create the file (and any missing parent directories) when the target path does not exist, similar to how the local filesystem fallback behaves using fs.mkdir(recursive) + fs.writeFile.

Client information

Client Information
  • OS: Darwin 24.1.0 arm64
  • Node: v22.22.0
  • VSCode: 1.111.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-triageIssue needs to be triaged and labeledtype/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions