[GH-ISSUE #15294] issue: SyntaxError: The string did not match the expected pattern #33052

Closed
opened 2026-04-25 06:54:46 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @bharath21mob on GitHub (Jun 25, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15294

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.15

Ollama Version (if applicable)

No response

Operating System

iOS

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

I am using Open-WebUI along with CapacitorJS to load the HTML pages statically and change the backend API. With this approach I am able to fetch chats, model, do authentication etc.,

Now, when I send a message I should get a streamed response

Actual Behavior

I am not getting the streamed response. Instead I get the following error

SyntaxError: The string did not match the expected pattern

Steps to Reproduce

  1. Clone open-webui repository.

Create a new directory for your project

mkdir openwebui-mobile
cd openwebui-mobile

Initialize a new npm project

npm init -y

Install Capacitor CLI

npm install -D @capacitor/cli @capacitor/core

Initialize Capacitor

npx cap init

  1. capacitor.config.json

{ "appId": "com.yourcompany.openwebuimobile", "appName": "OpenWebUI Mobile", "webDir": "src", "server": { "androidScheme": "https" }, "plugins": { "SplashScreen": { "launchShowDuration": 2000, "backgroundColor": "#ffffff", "showSpinner": false } } }

Add iOS platform

npx cap add ios

Add Android platform

npx cap add android

Install additional plugins for better mobile experience

npm install @capacitor/app @capacitor/splash-screen @capacitor/status-bar

  1. backend-config.js

`(function() {
const BACKEND_URL = 'https://opeai.bharath.xyz';
const WS_URL = 'wss://opeai.bharath.xyz';

// Only redirect API calls
const originalFetch = window.fetch;
window.fetch = function(url, options = {}) {
    if (typeof url === 'string' && url.startsWith('/')) {
        url = BACKEND_URL + url;
    }

    // Force credentials to 'omit' to work with wildcard CORS
    options = options || {};
    options.credentials = 'omit';
    return originalFetch(url, options);
};

// Fix WebSocket connections
const OriginalWebSocket = window.WebSocket;
window.WebSocket = function(url, protocols) {
    // Replace capacitor WebSocket URLs with backend URL
    if (typeof url === 'string') {
        if (url.includes('ws://capacitor') || url.includes('wss://capacitor')) {
            url = url.replace(/wss?:\/\/capacitor/, WS_URL);
        } else if (url.startsWith('/')) {
            url = WS_URL + url;
        }
    }
    
    console.log('WebSocket connecting to:', url);
    return new OriginalWebSocket(url, protocols);
};

// Preserve WebSocket static properties
Object.setPrototypeOf(window.WebSocket, OriginalWebSocket);
window.WebSocket.prototype = OriginalWebSocket.prototype;
window.WebSocket.CONNECTING = 0;
window.WebSocket.OPEN = 1;
window.WebSocket.CLOSING = 2;
window.WebSocket.CLOSED = 3;

})();`

Logs & Screenshots

Image

Additional Information

No response

Originally created by @bharath21mob on GitHub (Jun 25, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/15294 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.15 ### Ollama Version (if applicable) _No response_ ### Operating System iOS ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior I am using Open-WebUI along with CapacitorJS to load the HTML pages statically and change the backend API. With this approach I am able to fetch chats, model, do authentication etc., Now, when I send a message I should get a streamed response ### Actual Behavior I am not getting the streamed response. Instead I get the following error `SyntaxError: The string did not match the expected pattern` ### Steps to Reproduce 1. Clone open-webui repository. 2. ### Create a new directory for your project mkdir openwebui-mobile cd openwebui-mobile ### Initialize a new npm project npm init -y ### Install Capacitor CLI npm install -D @capacitor/cli @capacitor/core ### Initialize Capacitor npx cap init 3. capacitor.config.json `{ "appId": "com.yourcompany.openwebuimobile", "appName": "OpenWebUI Mobile", "webDir": "src", "server": { "androidScheme": "https" }, "plugins": { "SplashScreen": { "launchShowDuration": 2000, "backgroundColor": "#ffffff", "showSpinner": false } } }` 4. ### Add iOS platform npx cap add ios ### Add Android platform npx cap add android ### Install additional plugins for better mobile experience npm install @capacitor/app @capacitor/splash-screen @capacitor/status-bar 5. backend-config.js `(function() { const BACKEND_URL = 'https://opeai.bharath.xyz'; const WS_URL = 'wss://opeai.bharath.xyz'; // Only redirect API calls const originalFetch = window.fetch; window.fetch = function(url, options = {}) { if (typeof url === 'string' && url.startsWith('/')) { url = BACKEND_URL + url; } // Force credentials to 'omit' to work with wildcard CORS options = options || {}; options.credentials = 'omit'; return originalFetch(url, options); }; // Fix WebSocket connections const OriginalWebSocket = window.WebSocket; window.WebSocket = function(url, protocols) { // Replace capacitor WebSocket URLs with backend URL if (typeof url === 'string') { if (url.includes('ws://capacitor') || url.includes('wss://capacitor')) { url = url.replace(/wss?:\/\/capacitor/, WS_URL); } else if (url.startsWith('/')) { url = WS_URL + url; } } console.log('WebSocket connecting to:', url); return new OriginalWebSocket(url, protocols); }; // Preserve WebSocket static properties Object.setPrototypeOf(window.WebSocket, OriginalWebSocket); window.WebSocket.prototype = OriginalWebSocket.prototype; window.WebSocket.CONNECTING = 0; window.WebSocket.OPEN = 1; window.WebSocket.CLOSING = 2; window.WebSocket.CLOSED = 3; })();` ### Logs & Screenshots ![Image](https://github.com/user-attachments/assets/c8af4b73-2ef4-4ea0-b91a-cffeb1e1473f) ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-25 06:54:46 -05:00
Author
Owner

@tjbck commented on GitHub (Jun 25, 2025):

Outside of the scope.

<!-- gh-comment-id:3004061936 --> @tjbck commented on GitHub (Jun 25, 2025): Outside of the scope.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#33052