Obs Form fails after Bahmni 0.93 to Standard 1.0.0 migration – Invalid Base64 and “Unexpected token ')'”

Hello Bahmni Community, @angshuonline @mohant

We migrated from Bahmni 0.93 non-Docker to Bahmni Standard 1.0.0 Docker following the community documentation.

After migration, we are facing issues with some existing Obs Forms:

  1. Some forms open as a blank popup with these errors:
InvalidCharacterError: Failed to execute 'atob'
Error executing form init script:
SyntaxError: Unexpected token ')'
  1. Some other forms are not loading because their translation files are missing or not found after migration.

Has the form script encoding or translation-file structure/location changed in Bahmni 1.0.0? Is any additional migration required for existing form scripts and translation files?

Issue 2: Form translation API returns 500

For some migrated forms, the translation API fails with a 500 Internal Server Error:

GET /openmrs/ws/rest/v1/bahmniie/form/translations
    ?formName=ENT+Assessment
    &formUuid=c54cdbd0-491f-42b2-b3c7-5cd71b35a781
    &formVersion=3
    &locale=en
Status: 500 Internal Server Error

Because of this error, the translation file is not loaded and the form cannot be displayed correctly.

Could this be caused by missing translation records/files after migration from Bahmni 0.93 to 1.0.0? Is there any additional migration step required for Forms2 translations?

Screenshots are attached. Any guidance would be appreciated.

Thank you.

Hi @sjcoders,

These are known pain points when migrating from Bahmni 0.93 (non-Docker) to Bahmni Standard 1.0.0 (Docker). Here’s what’s likely happening and how to address each issue:

Issue 1: InvalidCharacterError: Failed to execute 'atob' and SyntaxError: Unexpected token ')'

The atob() error indicates that the form’s saved JavaScript/JSON content contains characters that are not valid Base64. In Bahmni 0.93, form scripts and templates were stored in the form_resource table (in implementer_interface resources) as CLOBs. In 1.0.0, the encoding expectations may have changed — specifically, the form resource values are expected to be valid Base64-encoded JSON.

What to check:

  1. Query form_resource for the affected forms and inspect the value_reference column. If it contains raw JSON (not Base64-encoded), that’s your problem.

  2. Some older forms may have had hand-edited scripts with syntax errors (the Unexpected token ')') that were previously tolerated by the old form renderer but are now strict-parsed.