Updating Envronment Script fails on windows

Where does the bug appear (feature/product)?

Background Agent (GitHub, Slack, Web, Linear)

Describe the Bug

Editing “Update Script” in browser on windows will cause error regarding to new line. The system says like Unexpected token “\r” found.

Steps to Reproduce

On WIndows, Enter echo “Foo” (newline) echo “Bar”.

Expected Behavior

CRLF is converted to LF.

Operating System

Windows 10/11

Version Information

Cursor website

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a bug on our side. When you type a script in the browser editor on Windows, it inserts CRLF \r\n, and the \r ends up in the command that runs via bash. That’s why you see Unexpected token "\r". We don’t currently normalize CRLF to LF on this path. I’ve filed an internal report.

Workarounds for now:

  • Put the commands on one line using &&, with no line breaks: echo "Foo" && echo "Bar"
  • Or write the script in an editor that uses LF line endings, then paste the final text in, avoiding line breaks typed directly in the browser.

If none of that works, let me know and we’ll dig in more.

I hope to see cursor normalizes CRLF after edit.

Can confirm this did not happen about a month ago when I was only updating
my scripts on a Linux machine. But yesterday I used a Windows machine and
updated a script there, and the script failed with the same issue.

In my case, for some reason, back on the Linux machine, even after trying
every possible fix, including pasting the script into the Cursor IDE,
changing the line endings to LF, and just pasting it into the browser, it
still runs into the same issue when booting up the environment, both in
Cursor automations and in regular cloud agents.

Hey, thanks for confirming. The Windows part is a known bug on our side. The browser editor inserts CRLF \r\n, and the \r makes it to bash. We’re tracking it, but there’s no ETA for a fix yet.

For now, the workaround is to remove line breaks by chaining commands with && into a single line:

echo "Foo" && echo "Bar"

The second issue you described sounds like a separate thing. A script with LF pasted on Linux still fails when the environment starts. That’s not the same case as CRLF on Windows, so I’d like to dig into it separately. Can you send:

  • the script itself, the one that doesn’t work
  • the exact error text when the environment is loading
  • the agent or run ID where you reproduced it, and whether it’s automation or a regular cloud agent

With that, I can check what’s breaking on the Linux path.

Hello, thanks for the follow-up. I ended up not using the dashboard on my Windows machine at all, to avoid any interference with the tests, and kept trying other ways to make it work.

It seems I finally managed to fix it by deleting both the start and update scripts from the Cursor dashboard, saving the environment config with both of them empty, and then pasting them back in (still double-checking in an editor set to LF), then saving it again.

The setups are now working both in regular cloud agents as well as in automations.

Great find, and thanks for coming back with the fix. This will definitely help other user who run into the same thing.

The fact that a full re-save helped delete both scripts, save an empty config, then paste them back with LF and save again matches the same root cause. The saved config still had CRLF characters from earlier edits, and they were getting passed to bash when the environment started, including on Linux and in automations. Saving it empty cleared them out.

We’re aware of the CRLF bug, but I can’t share an ETA for a fix yet. Until then, these workarounds are solid:

  • Keep scripts on a single line using && with no line breaks, or
  • Use your method: clear both scripts, save empty, then paste the final text with LF and save again.

If the same environment startup error shows up again after this, send the agent/run ID and I’ll check the logs.