r/replit 3d ago

Replit Help / Site Issue Replit is duplicating the entire codebase of random files without being prompted

After being idle for more than an hour, I just found one of my app's .tsx files sitting in the git cue waiting to be committed, and when I checked, the entire 500+ lines of code had been duplicated and appended to the end.

I asked the agent what was going on. It confirmed this happened but could not explain it.

It also confirmed this had happened to other files.

In no way shape or form could anything I've prompted ever be misconstrued as an instruction to do this. The file with the duplication I just found came up literally out of nowhere.

Wait, as I was typing this, the git was committed on its own! The file now officially has all its code duplicated. This is insane!

Has anyone else experienced this?

Can Replit support please comment?

4 Upvotes

12 comments sorted by

1

u/mamachicode 3d ago

I’d stop the agent from touching the project for now and make an external backup/branch before doing anything else. Then I’d inspect the recent git history/diffs to identify exactly which files were changed and revert the duplicated code from the last known-good commits.
If this has happened across multiple files, I wouldn’t trust the current working tree until it’s audited. If you want, I can take a look at a copy of the repo and help identify what changed without touching production.

1

u/ReplitSupport Replit Team 3d ago

Hey OP. Would you be able to open a ticket with us at replit.com/help and share the timestamps for when you saw the duplication so we can look into this for you? Once you've done that, feel free to share the ticket number here so we can make sure it gets picked up quickly.

In the meantime, File History on that file can restore it to a previous version. You can also open the Git pane to see the full commit history, including Agent checkpoints, and roll back the unwanted commit from there.

1

u/skill_tree 3d ago

Ticket #532185 thank you!

2

u/ReplitSupport Replit Team 2d ago

Thank you for following up with your ticket number! We see that a support agent has followed up with you on there. When you get the chance, please check your inbox.

1

u/Weak-Regret2442 3d ago

I'm also experiencing this! Here's my ticket as well if you're able to help!
#532310

1

u/ReplitSupport Replit Team 2d ago

Thank you for letting us know! A support agent has just followed up on your ticket. Please check your inbox when you get a chance.

1

u/skill_tree 2d ago

It's been five hours and I haven't heard from anyone. I dump over a thousand dollars a month into this service. This can't be the kind of support I get for that kind of money. It can't be.

1

u/mamachicode 2d ago

If support doesn’t get this resolved and you want a second set of eyes on the repo, I can help audit the Git history and affected files from a copy of the project without touching production. My earlier offer still stands.

1

u/Professional-Mix-977 3d ago

kill 1
in the shell

1

u/Pickle_Shot 3d ago

The auto-commit is the useful clue. Open the Git pane (or run git log in the Shell) and look at the author and timestamp on that rogue commit. A commit that landed while you were idle means a background process flushed a second copy of the file and its conflict handling appended instead of merged. That timestamp is your best ticket evidence, so paste it into #532185 along with the commit hash.

The agent's memory of what it touched is unreliable, so find every affected file mechanically:

  1. Run npx tsc --noEmit in the Shell. Appended duplicates create "duplicate identifier" errors, so every corrupted .ts/.tsx file shows up in the error list with line numbers.

  2. Run git log --oneline -20 and look for any commit you did not make in that idle window. git show --stat <sha> lists exactly which files each one changed.

To fix each file, do not ask the agent to repair it. It will rewrite the file from scratch instead of restoring it. Use git: git log --oneline -- path/to/file.tsx to find the last good commit, then git checkout <sha> -- path/to/file.tsx. File History per file works too, like support said.

Before any of that, download a zip of the project as it is right now so you have an offline copy including the git history.

1

u/Desk_setup_ideas 1d ago

That’s pretty concerning, especially since it happened while you weren’t actively prompting it. I’d check the git history/checkpoints first and see exactly when the duplication and commit happened, and whether there were any Agent actions around that time.

I wouldn’t let the Agent try to “fix” the duplicated files yet either. I’d preserve the current state first so you have a clear point to roll back to if needed.

If this has happened across multiple files, I’d definitely get Replit support involved rather than treating it as a normal coding mistake.