openclaw - 💡(How to fix) Fix [Bug]: Control UI breaks due to Uncaught ReferenceError: process is not defined [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62909Fetched 2026-04-09 08:00:52
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
2
Timeline (top)
commented ×2labeled ×2

The OpenClaw Control UI loads index.html and static assets successfully, but the page stays blank because the browser bundle crashes during startup with Uncaught ReferenceError: process is not defined. The served JS bundle includes Node-only home/config path logic from src/infra/home-dir.ts, including a fallback to process.cwd(), which is invalid in the browser. The likely leak path is through src/utils.ts, which imports home-dir.ts and also eagerly evaluates export const CONFIG_DIR = resolveConfigDir(); at module load. That makes otherwise browser-safe imports from utils.ts drag Node-only code into the client bundle where it blows up.

Error Message

HTML is fine and can be curled from VM but browser dev console output shows that ../src/utils.js is dragging Node-only code into the client bundle and breaking things:

index-DiFqcmGv.js:607 Uncaught ReferenceError: process is not defined at hv (index-DiFqcmGv.js:607:880) at yv (index-DiFqcmGv.js:607:1465) at index-DiFqcmGv.js:607:1543

Root Cause

The OpenClaw Control UI loads index.html and static assets successfully, but the page stays blank because the browser bundle crashes during startup with Uncaught ReferenceError: process is not defined. The served JS bundle includes Node-only home/config path logic from src/infra/home-dir.ts, including a fallback to process.cwd(), which is invalid in the browser. The likely leak path is through src/utils.ts, which imports home-dir.ts and also eagerly evaluates export const CONFIG_DIR = resolveConfigDir(); at module load. That makes otherwise browser-safe imports from utils.ts drag Node-only code into the client bundle where it blows up.

Code Example

HTML is fine and can be curled from VM but browser dev console output shows that ../src/utils.js is dragging Node-only code into the client bundle and breaking things:

index-DiFqcmGv.js:607 Uncaught ReferenceError: process is not defined at hv (index-DiFqcmGv.js:607:880) at yv (index-DiFqcmGv.js:607:1465) at index-DiFqcmGv.js:607:1543
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

The OpenClaw Control UI loads index.html and static assets successfully, but the page stays blank because the browser bundle crashes during startup with Uncaught ReferenceError: process is not defined. The served JS bundle includes Node-only home/config path logic from src/infra/home-dir.ts, including a fallback to process.cwd(), which is invalid in the browser. The likely leak path is through src/utils.ts, which imports home-dir.ts and also eagerly evaluates export const CONFIG_DIR = resolveConfigDir(); at module load. That makes otherwise browser-safe imports from utils.ts drag Node-only code into the client bundle where it blows up.

Steps to reproduce

  1. Start gateway in Docker container following manual flow
  2. ssh into the VM ssh -N -L 18789:127.0.0.1:18789 user@host (I used WSL2 instance)
  3. launch browser http://127.0.0.1:18789/#token=xxxxxxxxxxx
  4. Favicon loads with blank html body due to Uncaught ReferenceError: process is not defined

Expected behavior

Expected to load the OpenClaw Control dashboard...

Actual behavior

Favicon loads ok but we get Console error:

index-DiFqcmGv.js:607 Uncaught ReferenceError: process is not defined at hv (index-DiFqcmGv.js:607:880) at yv (index-DiFqcmGv.js:607:1465) at index-DiFqcmGv.js:607:1543

"because ../src/utils.ts contains Node-only path/home/config code plus a top-level CONFIG_DIR initializer, the whole module drags Node code into the browser bundle and it explodes."

OpenClaw version

2026.4.7

Operating system

Ubuntu 24.04.4 LTS

Install method

Docker

Model

gpt-5.4

Provider / routing chain

openclaw in Docker -> LAN -> ssh -> WSL2 -> Windows10 -> Microsoft Edge 146.0.3856.97

Additional provider/model setup details

No response

Logs, screenshots, and evidence

HTML is fine and can be curled from VM but browser dev console output shows that ../src/utils.js is dragging Node-only code into the client bundle and breaking things:

index-DiFqcmGv.js:607 Uncaught ReferenceError: process is not defined at hv (index-DiFqcmGv.js:607:880) at yv (index-DiFqcmGv.js:607:1465) at index-DiFqcmGv.js:607:1543

Impact and severity

Affected: NOT_ENOUGH_INFO Severity: 10/10 cannot launch dashboard Frequency: always Consequence: failed user onboarding

Additional information

NOT_ENOUGH_INFO

extent analysis

TL;DR

The issue can be fixed by preventing Node-only code from being included in the browser bundle, likely by modifying the src/utils.ts file to avoid eager evaluation of Node-specific logic.

Guidance

  • Identify and refactor the src/utils.ts file to avoid importing Node-only code from home-dir.ts or to delay the evaluation of export const CONFIG_DIR = resolveConfigDir(); until it's known to be running in a Node environment.
  • Consider using a build-time check or a separate build process for the browser bundle to exclude Node-only code.
  • Review the import chain to ensure that no other modules are inadvertently dragging in Node-only code.
  • Verify that the fix works by checking the browser console for the absence of the Uncaught ReferenceError: process is not defined error and ensuring the OpenClaw Control dashboard loads correctly.

Example

// src/utils.ts
// Instead of eager evaluation, consider delaying the evaluation of CONFIG_DIR
// or using a build-time check to exclude Node-only code
export const CONFIG_DIR = typeof process === 'undefined' ? null : resolveConfigDir();

Notes

The exact fix will depend on the specific requirements and constraints of the OpenClaw Control UI project, including the build process and the desired behavior of the CONFIG_DIR constant.

Recommendation

Apply a workaround by modifying the src/utils.ts file to avoid including Node-only code in the browser bundle, as this is the most direct way to address the issue without upgrading to a potentially non-existent fixed version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected to load the OpenClaw Control dashboard...

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING