Perforce Librarian checkout [path to file] failed

The following article is meant to assist you in fixing a specific problem. Data will be removed if you follow the instructions. I provide no warranty so follow these instructions at your own risk. I always recommend that you reach out to Perforce Support rather than attempting fixes yourself. Always make sure you have a backup of your Perforce databases and versioned files. If you do not know how to back them up then you should not be reading this article. Save yourself some pain and contact support.

When attempting to access a file in your Perforce code repository you may experience the following

error.Librarian checkout [path to file] failed
Error opening librarian file [path to file] revision #.#####.
RCS checkout #.##### failed!
RCS no such revision #.#####!

There is a knowledgebase article that describes how to fix this. I’m writing this article to shortcut some parts. The fix requires you set up the command line environment and most of us admins don’t have the command line environment for accessing files configured as we don’t check out and check in files from the command line all the time.

Here is the knowledgebase article: http://answers.perforce.com/articles/KB/3186/

Below are the steps you need to take on your client workstation, not your server. I accomplished this on a Mac. The same instructions will work for Linux. You can translate the instructions for a Windows system by changing the directory nomenclature.

1. Download and install the perforce command line client. https://www.perforce.com/downloads/helix

2. Install and create a path either in a ~/.bash_profile

#Contents of .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
# the path to Users/adminmatto/perforce is the location of my p4 executable.
PATH=$PATH:$HOME/bin:/Users/adminmatto/perforce

export PATH

#P4Port contains the DNS hostname of your server and the port on which it runs.
P4PORT=[DNS hostname of the server]:1666

export P4PORT
#Your perforce username
P4USER=adminmatto

export P4USER
#Its bad form to store the password but some people may want to do it.
P4PASSWD=[password here if you want to]

export P4PASSWD

3. Now that you have Perforce configured you need to create a client that maps your workstation directory and your repository. Use the command p4 client [name you want to call it]. This should bring up an editor with a client file. You need to verify the hostname is correct and set your root path. The root path should be the path on your machine where checked out Peforce files will be stored. In my case, I made my root path ~/perforce

4. Now from the terminal change directory to that location. Run the following command to connect and get changes.

p4 sync -k //[your perforce depot name]/…

5. After the sync is complete, you are ready to remove the bad revisions.

p4 obliterate //your perforce depot name/[path to the file in question]#[revision number]

#note that this command will not delete anything until you add the -y switch. It will simply report what it will do.

When you are ready to proceed deleting the command becomes…

p4 obliterate -y //your perforce depot name/[path to the file in question]#[revision number]

This entry was posted in Versioning Software. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *