Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: No file found for undefined" when field has 'name: data' #7399

Open
werenike opened this issue Feb 10, 2025 · 0 comments
Open

"Error: No file found for undefined" when field has 'name: data' #7399

werenike opened this issue Feb 10, 2025 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@werenike
Copy link

werenike commented Feb 10, 2025

Describe the bug
If config.yml defines a file collection containing a file with a field with name: data, trying to publish changes to that file through the CMS causes an error toast with "Error: No file found for undefined in {collection name}" and the update fails.

To Reproduce
For me, this problem happens when I have the following in my config.yml (besides backend and some url and path configuration like media_folder etc). The important part is the name: data field in File.

collections:
  - label: 'Collection'
    name: collection
    files:
      - label: 'File'
        name: file
        file: file.json
        fields:
          - name: data

If I then open the CMS and open up the editor for File, any existing value for the 'data' field is shown as expected. However, if I edit that value and then press the button to publish, the error is shown ("Error: No file found for undefined in collection") and the update fails.

Expected behavior
Don't show an error and update the file.

Applicable Versions:

  • Decap CMS version: 3.6.1
  • Git provider: Codeberg.org
  • OS: Manjaro Linux
  • Browser version: Brave 1.75.175 Chromium: 133.0.6943.54 (Official Build) (64-bit)

Additional context
Some things that I found while investigating this problem:

  • To produce the error, the filename does not matter (eg file.json) and neither does the extension (tested with json and yml). Also the name values of the File and the Collection don't matter.
  • The error does not occur when name: data is used somewhere else in the config, ie for the file or the collection. The error only occurs when name: data is used for the field.
  • The error does not occur when name: data is changed to something else, like datax or field1.

A little background on why I want a field with name: data: I want to be able to edit (part of) the config file of JSSSG through Decap CMS, specifically the data field that defines global site data. I can think of workarounds to this error (like having the CMS edit a field called datax and then changing it to data in my build process, or something), but I'd rather not have to resort to that.

Is this indeed a bug, or am I doing something wrong here? I'd be very grateful for any insights! Thanks in advance.

@werenike werenike added the type: bug code to address defects in shipped code label Feb 10, 2025
@werenike werenike changed the title "Error: No file found for undefined" when field has 'data' as name "Error: No file found for undefined" when field has 'name: data' Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant