SyntaxError: JSON.parse fails in initFileField — data-label-overwrites attribute malformed

A JavaScript error is consistently thrown on pages containing brf-pro-forms-field-file elements with custom label overwrites configured. The error occurs in the internal initFileField function and breaks field initialization.

Error:

Uncaught SyntaxError: Expected ',' or '}' after property value in JSON at position 63
    at JSON.parse (<anonymous>)
    at window.bricksforgeData.initFileField

Steps to reproduce:

  1. Create a Pro Forms field of type File Upload
  2. Set a custom label in the Label Idle field (e.g. with HTML span tags)
  3. Load the page containing the form
  4. Open browser console — error is thrown immediately on page load

Expected behavior: Field initializes correctly without console errors.

Actual behavior: JSON.parse fails at position 63 of the data-label-overwrites attribute, which appears to be generated with malformed JSON by the plugin itself.

Additional context:

  • The error fires twice when two file upload fields exist on the same page
  • Changing fileUploadAllowedTypes format had no effect
  • Removing initialFilesMethod: custom had no effect
  • The issue is reproducible across different file upload fields and configurations

Environment:

  • BricksForge version: [3.1.8.5]
  • Bricks Builder version: [2.3.4]
  • WordPress version: [6.9.4]

Hey, thanks for the detailed report!

I tried to reproduce this on our end with the same setup — File Upload field with custom HTML in the Label Idle field — but no JSON.parse error appears. The field initializes
correctly.

Could you try the following?

  1. Temporarily deactivate all plugins except Bricksforge and Bricks
  2. Clear all caches
  3. Check if the error still appears

If the error is gone, re-enable plugins one by one to find the culprit. Most likely it will be a caching or minification plugin.

Let me know what you find!