Legacy Knowledge Base
Published Jun. 30, 2025

Guest User cannot upload File in Form - An unexpected error occurred

Written By

Tímea Bihari

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • We have a Form with an Upload field where authenticated users can upload files but Guests cannot.
  • All permissions are provided for Guest user.
  • When the user selects the file to upload, an error message appears immediately: "An unexpected error occurred while uploading your file."
  • If we add "com.liferay.dynamic.data.mapping.form.web.internal.upload.DDMFormUploadResponseHandler" with DEBUG in Server Administration > Logs, we see the following error:
DEBUG [http-nio-8080-exec-630][DDMFormUploadResponseHandler:56] null
com.liferay.portal.kernel.exception.NoSuchUserException: No User exists with the key {companyId=20101, screenName=ddm_form_default_user_screen_name}
    at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.findByC_SN(UserPersistenceImpl.java:4582) ~[portal-impl.jar:?]

 

Environment

  • Liferay DXP 7.3 under Update 31
  • Liferay DXP 7.4 under Update 76

 

Resolution

  • When "Autogenerate User Screen Names" is ticked in Instance Settings > Users > Fields, the ddm form default user is created with a screen name of "ddm.form.default.user.screen.name".
  • This differs from the screen name the DocumentLibraryDDMFormFieldTemplateContextContributor expects ("ddm_form_default_user_screen_name"), so any form using an upload field throws an exception.
  • A fix was implemented with LPS-133096 from u76 for 7.4 and u31 for 7.3.

 

Additional Information

The following workaround is available:

  1. Navigate to Control Panel > Server Administration > Script
  2. Run the following script:
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.dynamic.data.mapping.constants.DDMFormConstants;

UserLocalServiceUtil.updateScreenName(userId, DDMFormConstants.DDM_FORM_DEFAULT_USER_SCREEN_NAME);

Before running the script, make sure that you create a backup from the database so that it can be restored if needed.

Did this article resolve your issue ?

Legacy Knowledge Base