Posted September 20th, 2011 by markbudos
I keep receiving this error when I try and deploy over ftp or sftp (works if I publish locally)
Error 1 Item has already been added. Key in dictionary: '(path)' Key being added: '(path)'
The item gets added to the file system, but it stops after this error. If I deploy again, the same thing happens...it creates one file, then stops with this error.
Samuel Lim says:
The problem is that VS.php creates new folders without write permissions. My quick fix was to chmod the new folder with 777 each time I encountered this.
@JCX: please fix this!
It is really slowing down my deploys.
juanc says:
What is the permissions that are before you change to 777?
Juan
jjhii says:
I have the same problem, files are set to 755 after deployment...
juanc says:
I have not been able to reproduce this problem.
Any suggestions on what should I do to repro this issue?
wilkyboy says:
I get the same problem, but it appears to have appeared with the newer versions of VSPHP. When using SFTP to upload the files to the server.
Why use SFTP? 1) it's secure and 2) it's much easier to set up than FTP using OpenSSH's internal SFTP server and 3) it is installed by default on all new versions of most common Linux distros. Note that my SFTP users are chrooted to /home and www is mounted as a directory inside their own home directory, so /nick/www is a mount to /var/www -- although I doubt that makes a difference, but it may be useful information.
With the latest versions of VSPHP when I deploy the site using SFTP to a Linux (Ubuntu) server then I get messages such as "Error 1 Item has already been added. Key in dictionary: '/nick/www/website/system/' Key being added: '/nick/www/website/system/'". I ONLY get this message when creating a new directory and ONLY at the time the directory is created, at which point the deploy fails. The directory is created with permissions 755 -- more on this in a moment. Now, what's interesting is that when I retry the deploy then the directory does NOT need to be created and so any files inside the directory are pushed to the server correctly (also permissions 755, for a file!). But then the NEXT directory to be created also causes Error1 and the deploy stops. And you can keep doing this until all the directories and the files inside them have been deployed (several hundred, unfortunately).
So, what's interesting about 755? Weeeell, I have ACL active on my servers to set the group and permissions to www-data and g:rwx:
sudo setfacl -Rdm g:www-data:rwx /var/www
sudo setfacl -Rm g:www-data:rwx /var/www
Which by my reckoning would give permissions of 775. So why is VSPHP forcing it to 755? That middle 5 appears to be a candidate issue.
Just to isolate the issue, I tried to push the same project to my newest server, which is Ubuntu 11.04 and to an old-faithful server, which is 10.04LTS and it fails identically to the above on BOTH servers, even when old-faithful used to succeed every time. Therefore, in my mind the issue is not with the server and not with a change to the configuration to the server, but a change to the SFTP library, or the configuration of that library, that is built into and used by VSPHP.
Does that make sense?
More information on request.
UPDATE: I just pushed the 458 files to the server using EXACTLY the same SFTP credentials but using FileZilla and everything went perfectly and also the permissions on the directories and files were all 775 as they should be (according to ACL) and NOT 755.
juanc says:
Care to try the build from here?
http://svn.jcxsoftware.com
wilkyboy says:
Hi Juan,
I can confirm that version vsphp_en_2.10.6875 fixes this issue for me using VS2008.
Many thanks!
Nick.