DOCX File Attachment Extraction receives 500 Error

In Pega 25.1.3 or 26.1 - When I tried to ingest DOCX and extract the fields, present it to case - am getting consistently Error:500 Internal Server Occurred

I’ve implemented the following using Gen AI Connect as shown below.

.ClaimFile attachment category field details are available in Clipboard.

Note: I’ve tried the same using PDF ingestion and extraction working as expected.

Detailed Error:

I’m wondering, are there any product issue related to DOCX attachments? - Looking forward to hearing any suggestions / inputs in this regard.

What model are you using. check out this Documentation page towards the bottom is hte support matrix for models vs documents. Pegasystems Documentation

VesselName is limited to 256 characters as per your data model, however the GenAI response is containing VesselName more than 256 characters.

Increase the property length to XXX characters or ensure the prompt returns only within 256 characters limit

@STEWJ - I’ve tried both Default-Fast Haiku , Default Smart (Sonnet) model as per Pega documentation.

@RameshSangili - I’ve tried with property without character length limitation but getting the same 500 error.

Could you please map it to a new property with greater length and test it out?

@RameshSangili - In 26.1, created a new data object and then created each of the new properties via App explorer without Max length. However, post creation of property, I could see it’s enforcing to set 256 characters as shown below.

Here’s the minimal mapping of Gen AI connect with scalar properties as shown below

Based on tracer, received 500 error as shown below.

Here’s the full stack trace error for reference.

{“title”:“Internal Server Error | Unexpected internal error: string indices must be integers, not ‘str’”,“detail”:“Unexpected internal error: string indices must be integers, not ‘str’”,“stack_trace”:“at /lean/main/api/endpoints/models.py:231 in handle_model_response \nAdditional details: Traceback most recent call last:\n File “/lean/main/api/endpoints/models.py”, line 221, in handle_model_response\n response = await model.aget_response\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n messages=processed_messages, tools=request.tools, stream=request.stream\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n \n ^\n File “/lean/main/trace/bedrock_instrumentor.py”, line 100, in _async_tracing_wrapper\n response = await wrapped*args, **kwargs # Call original async function\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 1413, in aget_response\n raise e\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 1390, in aget_response\n self._prepare_bedrock_requestmessages, tools, functions\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 1319, in _prepare_bedrock_request\n br_messages, system_message, tools = self.openai_to_bedrock\n ~~~~~~~~~~~~~~~~~~~~~~^\n messages=messages, tools=tools, functions=functions\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n \n ^\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 1122, in openai_to_bedrock\n self.process_messages\n ~~~~~~~~~~~~~~~~~~~~~^\n messages, system_msg, last_user_message, bedrock_messages, variable_messages,\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n \n ^\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 1041, in process_messages\n last_user_message = self.user_message_content_mappingmessage\n File “/lean/main/autopilot/models/bedrock/chat_completions_base.py”, line 302, in user_message_content_mapping\n if content_item[“type”] == “text”:\n ~~~~~~~~~~~~^^^^^^^^\nTypeError: string indices must be integers, not ‘str’\n\nDuring handling of the above exception, another exception occurred:”,“errorCode”:“AP-400-001”,“llm_traces”:null}

Could you please check if this issue exists on 25.1.2 or 25.1.3 version to isolate the issue? Also, Can you please check with other document if you’re facing the same issue? Stacktrace indicates string indices must be integers, not ‘str’”,

Yes, same issue observed in Pega 25.1.3. When I tried using PDF with same codebase, it’s working correctly as shown below.

Here’s attached sample DOCX for reference incase if you would like to replicate this issue at your end.

Claims Test Copy.docx (23.4 KB)