"Translation of file content failed..." error in Perforce
Asked Answered
K

5

10

I have the following error message in when submitting from my perforce client (p4v):

Translation of file content failed near line 1 Submit aborted -- fix problems then use 'p4 submit -c 22'. Some file(s) could not be transferred from client.

I don't know what it means or how to solve the problem.

Kampong answered 1/3, 2011 at 15:57 Comment(1)
You should consider contacting Perforce support, it is usually outstanding.Simoom
G
13

Perforce may be confused as to the file's type. Perhaps this is a binary file that Perforce thinks is text? Right click on the file and select the "Change Filetype..." item. This will open a dialog that allows you to change the file's type. Make sure it is set correctly and submit the file again.

Group answered 1/3, 2011 at 17:18 Comment(3)
Thank you! This was the problem. Now I have other problem, I have many files with this issue.Kampong
You can select multiple files in P4V and apply this change file type operation. However, you can't do it on a folder. The "Change Filetype..." item doesn't appear on a folder's context menu. If you really have a huge number of files to change, you can do it from the command line with the -t switch on the edit command: p4 edit -t <new filetype> //foo/bar/...Group
I actually had the opposite (.txt file considered as bin file) so changing the Filetype fixed my issue. Thanks a lot!Stanislaw
A
18

The real porblem is the encoding, set the encoding to UTF-8 using the "Connection -> Choose Character Encoding..." menu item fixed the problem

Acentric answered 8/4, 2013 at 7:21 Comment(0)
G
13

Perforce may be confused as to the file's type. Perhaps this is a binary file that Perforce thinks is text? Right click on the file and select the "Change Filetype..." item. This will open a dialog that allows you to change the file's type. Make sure it is set correctly and submit the file again.

Group answered 1/3, 2011 at 17:18 Comment(3)
Thank you! This was the problem. Now I have other problem, I have many files with this issue.Kampong
You can select multiple files in P4V and apply this change file type operation. However, you can't do it on a folder. The "Change Filetype..." item doesn't appear on a folder's context menu. If you really have a huge number of files to change, you can do it from the command line with the -t switch on the edit command: p4 edit -t <new filetype> //foo/bar/...Group
I actually had the opposite (.txt file considered as bin file) so changing the Filetype fixed my issue. Thanks a lot!Stanislaw
D
5

FWIW, this issue just occurred to me and I was unable to revert any files or perform pretty much any operation. Even removing files from workspace and then trying to get them again caused the translation of file content error. This issue started happening for me after P4V crashed.

To fix it, I just went to Connection > Choose Character Encoding and clicked OK on the dialog box (did not change the encoding to anything else - kept it what it already was) and that fixed it for me.

Discriminative answered 28/8, 2015 at 3:49 Comment(0)
I
1

This problem can also occur when the file doesn't actually exist on disk. A couple of scenarios can play into this.

  1. You open a file for 'add' before the file actually exists on disk. This is possible and allowed by Perforce. If you 'p4 add' a file before it exists and then try and submit the changelist before you actually put a local file in place, you will get this error.
  2. You open a file for 'edit' and then by some mechanism, delete the file locally before you submit. Again, when submitting, you will see this error.

Honestly, I'm a bit surprised that the error indicated in the original question was due to a filetype mismatch. I've never seen that be the case. In case (1), a file that is 'p4 add'ed will be added as type 'text' by default if a file doesn't exist on disk. If the file was supposed to be a binary file, that would indicate a type mismatch, but that's not the cause of failure to transfer the file from the client. It's the fact that the file doesn't exist.

Anyway, that's my experience. I figured that i would share the cases where I've seen this error.

Ideology answered 2/3, 2011 at 16:13 Comment(1)
File type confusion is a rare occurrence in Perforce, but it can happen. I've seen it once in 7+ years of Perforce use.Group
B
0

This is a mismatch of what your local workspace thinks the file is compared to what the server is willing to accept via its typemap.

It seems like my local workspace AssemblyInfo.cs converted a file to UTF16 (since it contained some UTF16 chars). When I changed the filetype back to text I was able to submit flawlessly.

So you can either.

  1. Change the filetype to match what you see with the p4 typemap in command prompt. (Ex: text //....cs indicates that .cs file should be of text type.)
  2. Change the typemap to match what your local workspace believes it to be.
  3. If the file is unneeded, consider adding it to your .p4ignore file.
Bibliophage answered 26/10, 2023 at 7:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.