Why do I get a "Does not support multiple programs" error when adding a patient to a new program?

Hi,

I have enrolled a pacient to a PMTCT program in OpenMRS until it’s closure [PREGNANCY STATUS: DELIVERY] .

After few years the same pacient became pregnant again and i added her to a new PMTCT program.

When i try to change the PREGNANCY STATUS of the second enrollment through a form using workflowState tag it gives me the following error:

SEVERE: Servlet.service() for servlet [openmrs] in context with path [/openmrs] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Does not support multiple programs] with root cause
java.lang.IllegalStateException: Does not support multiple programs
	at org.openmrs.module.htmlformentry.HtmlFormEntryUtil.getPatientProgramByWorkflow(HtmlFormEntryUtil.java:1482)
	at org.openmrs.module.htmlformentry.element.WorkflowStateSubmissionElement.getActivePatientState(WorkflowStateSubmissionElement.java:187)
	at org.openmrs.module.htmlformentry.element.WorkflowStateSubmissionElement.<init>(WorkflowStateSubmissionElement.java:115)
	at org.openmrs.module.htmlformentry.handler.WorkflowStateTagHandler.getSubstitution(WorkflowStateTagHandler.java:51)
	at org.openmrs.module.htmlformentry.handler.SubstitutionTagHandler.doStartTag(SubstitutionTagHandler.java:40)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:479)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTagsHelper(HtmlFormEntryGenerator.java:496)
	at org.openmrs.module.htmlformentry.HtmlFormEntryGenerator.applyTags(HtmlFormEntryGenerator.java:452)
	at org.openmrs.module.htmlformentry.FormEntrySession.createForm(FormEntrySession.java:405)
	at org.openmrs.module.htmlformentry.FormEntrySession.getHtmlToDisplay(FormEntrySession.java:752)
	at org.openmrs.module.htmlformentry.web.controller.HtmlFormEntryController.getFormEntrySession(HtmlFormEntryController.java:188)
	at sun.reflect.GeneratedMethodAccessor1227.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:162)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:76)
	at org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:58)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:111)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

Any suggestions?

Did you manage to resolve this? Is this happening with eSaude EMR?

1 Like

Hi pascal unfortunatelly i didn’t get through this yet. And yes it’s happening with the eSaude EMR.

Can you help?

I’m not able to reproduce this issue on demo.esaude.org @matcha. I create a patient, then enrole them in the PTV/ETV program. I then transition them to a completion state in the program, and afterwards I’m able to enrole them again:

Can you give me the steps to reproduce this on the demo site?

1 Like