Updating Records Temp File Error

Created on 29 April 2025, 14 days ago

Problem

We have feeds import that runs once a week and create unique content type from a cvs data source. The records mostly have field values, but some add an image file or .txt files as well. It's common to set a basic record up and add more details later.

I have noticed that if data source updates a record with a .txt file and the .txt file isn’t updated it, then the feeds throws an error related to the .txt file and doesn’t update the record. If the .txt file is updated then the record is updated normally. Potentially this leaves a lot of manual cleanup.

Pseudo code example
Record1 is added with name field value information and a .txt file everything is generated correctly.

Later…
Records1 is updated with more field value for locations data, but the .txt is correct and thus not updated, the feeds throws an error and won’t update the record field values.

Any record without a .txt will update normally.

I am not sure how long the error has existed, it could have happened undetected, no error alerts are send when a record update fails if a user isn’t manually looking at the import.

Info

Error Example Message
File 'temporary://filegqK5QQ' could not be copied because a file by that name already exists in the destination directory ('').

You can see in the site files that the tmp folder is empty when the feeds import starts, but generated the stuck files names after import. Clear the temp files does nothing.

Drupal 10 site, pantheon hosted
Feeds 8.x-3.0 (previous version appeared to have the same issue
Feeds tamper is used, but doesn’t appear related to the issue.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dcdev11
  • 🇳🇱Netherlands megachriz

    I'm trying to figure out from your bug report what you are trying to do and what problem you actually face. It seems related to importing data into a file field on a node.

    Can you explain further with CSV examples what you are importing and at which moment something goes wrong and what goes wrong exactly?

    For example:

    1. Create a feed type using the CSV parser with mapping to Feeds Item Guid, title and a file field. Set Feeds Item guid as unique.
    2. Import the following CSV file:
      id,title,file
      1,Foo,http://www.example.com/file1.txt
      2,Bar,
      

      If I read correctly, this import goes fine. New records with a text file reference and new records without text a file reference are getting imported.

    3. Change the CSV file and import again.
      id,title,file
      1,Foo Updated,http://www.example.com/file1.txt
      2,Bar Updated,
      

    Record 2 updates fine, but for record 1 you get an error? Or do you get an error when on an update you reference a different text file? Or do you get an error if on an update the text file doesn't exist on the source?

  • The following are actually csv entries with dummy data that create a node type. The strings are all plain text, mostly names and other short values. Some numbers are internal, some are public facing and with associated template labels provide location information users can use and sometimes will report if they are inaccurate. The .txt file defines content for. a long description field.

    Every week a csv import file is submitted and a feeds import is run. In the most recent case it had over a record hundred changes, but it can be more or less. During the import records with a .txt file that have not been updated (but other fields have been updated) will fail to update, while other records will update as expected. The feeds log will confirm the record(s) that hit the temp files error and the total number of updated/created records will be lower by the number times the error happened.

    Working record update
    The .txt file and nothing else had been updated and the error didn't occur. This was an updated record, but if this had created a new record for the first time it appears to work as well from my testing on the dev site. It also would work if the other data had been updated along with the .txt file.

    “123”,”string”,”123,”string”,”string”,”123”,”123",”date”,”123”,”123”,”123”,”123”,"123,” ","string","string","string","string"," ","updated.txt","","string","123"

    Several other times, the records looked this. The "345" represent updated numeric data in the record field values. "same.txt" indicating no changes to the file contents (in either case the name of the file doesn't usually change). In this instance an error happens following this pattern "File 'temporary://filegqK5QQ' could not be copied because a file by that name already exists in the destination directory ('') and the record can't be updated with feeds.

    Failing record update
    “123”,”string”,”123,”string”,”string”,”123”,”123",”date”,”345”,”345”,”345”,”345”,"123,” ","string","string","string","string"," ","same.txt","","string","123"

    Most records don't have .txt files and update without issue
    Less advanced working record update
    “123”,”string”,”123,”string”,”string”,”123”,”123",”date”,”345”,”345”,”345”,”345”,"123,” ","string","string","string","string"," ","","","string","123"

    A typical node will look like this, but the fields are optional so some records have a lot more then others.
    "John/Jane Doe" //title
    "John/Jane Doe associates/associations"
    "More John/Jane Doe associates/associations"
    "a long description field" (from the .txt file)
    "an image of John/Jane Doe"
    "location data" ( a typical pattern this is tba and left blank, then added a month or so later)
    "date created"
    A couple of internal id fields that aren't displayed.

  • Looking at this I think I see an issue I didn't explain. The .txt files is extracted and become the description field value so it's not url link value or a file download location anything. A typical .txt is like bio, so it's content says "John Doe worked at the company 40 years and did all this stuff..." and that become the description field.

    id,title,file
    1,Foo,http://www.example.com/file1.txt
    2,Bar,

    id,title,file
    1,Foo Updated,http://www.example.com/file1.txt
    2,Bar Updated,

    Both of these would be expected to work if the file1's contents was updated. If we changed 40 to 50 in the years "John Doe worked at the company 50 years and did all this stuff..." then I'd expected to see any updates added to the record.

    If bar is updated, but file1 is the same content it generates a temp file, gets stuck, throws an error and bar is not updated in the record.

Production build 0.71.5 2024