Perforce, Technical

Error: Can’t clobber writable file Perforce

We use Perforce in our organization for Source Control. I was trying to get the latest revision for some of the files that were updated by other developers. and noticed the following error:

Can’t clobber writable file

I knew for a fact that files under source control were marked as read-only and when a file is checked out, then it removes the read-only attribute. So deciding to check on that I found that all the files under my perforce folder were not read-only. I went ahead and marked every file as read-only, and was able to get the latest revision without any errors. Cool, another problem solved.

22 thoughts on “Error: Can’t clobber writable file Perforce

  1. Hi Balaji, do you know why not all the files under your perforce were readonly?

    I have encountered the same problem, but changing the attribute manually is not acceptable because this needs to be automated (I am trying to sync perforce on a continuous integration server).

    I’d like to root cause this issue so I can prevent it from breaking our automated builds. Thanks!

    1. i faced the same problem that files were not read only.
      i think cause for this was that i had created new workspace for perforce, but same location on my system.

  2. Hi Ben,

    I am not sure as to what is the root cause of this. A possible workaround is to stop perforce from making the files read-only on submit. This can be accomplished by changing the Client Specification and setting the “allwrite” flag. This way the files never go to readonly mode and you should be able to write to it always.

  3. I encountered the same problem. Making the files readable fixed it.

    I did a “Get latest revision” and for some files I got the can’t clobber message. I had not touched these files at all. It turned out that these files were deleted and added again to perforce before.

    The clobber flag was unchecked in my workspace.

    That is, these files were deleted first by someone else, then I did a “Get latest revision” and then these files were added back again by someone else and then I did a “Get latest revision” again. Peforce was configured to delete deleted files after the first “Get latest revision”.

  4. i had the same problem. this is because when i wanted to make a chage in a synced file i was asked if i needed to make it writeble in visual studio. i made the file writeble but after that i couldnt find an option to make is readable again. and changing the attribue to read only did not help either.

    help needed!!1

  5. I know this is a very late reply to an almost dead post, but since its the first hit on google I am adding a reply for those of you googlers out there who may end up here.

    If you encounter a can’t clobber message like this, and ur afraid to loose what u did here is a neat trick:

    copy ur existing file to another file like file_carbon_copy.cpp
    and then remove the file causing the problem.
    Do a p4 sync, and the clobber message will go away.

    The latest revision will now be in ur directory. do a move (mv) of ur copy back into the same name of that file which u should have open for edit. The mv command does a replace, and then u can nicely submit.

    This said, if u have a branch and want to integrate with the root source, ur better off changing its readonly.


  6. look like it is not an automatin trick, why we need to use perforce when you have to copy and use all of that tricks ??? 🙂

  7. Thanks! To save time on the VPN with perforce I had used an old copy of a project that was 200MB+. Of course, the versions I copied into my local workspace were “NOT” read-only. So when I set the parent folder to “read only” (right click + properties), and applied the read-only permissions to all items in the workspace, I was able to get the latest revision of the project.

    Too bad it decided it wanted to download almost every file again 😦

  8. @Chad,
    Thank you for you trick. I was having same problem with Perforce and the culprit file was “Thumbs.db”. That required the “read-only” attribute to be set!

    Strange but worked!


  9. Thanks.
    I had the same problem with some .cs file. Your trick worked.
    But it gave error while trying to build, ofcourse becoz iit was read-only. So, again changed to writeble and built.


  10. Here is how I resolved the problem:
    P4 Ver: Rev. P4V/NTX86/2009.2/228098

    1.) Click “Connection” on the global menu
    2.) Select “Edit Current Workspace…”
    3.) On the “Form” tab, Under the “Options:” section, Select “allwrite”
    4.) Click Apply, then OK

    From here you should be able to retrieve the latest revision with no problems.

    1. Thank you so much Chris! I’m using the Perforce plugin for Eclipse and was having to constantly open my perforce folder to set files to read-write. This will save a lot of time.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s