April 23, 2026 β€’ Version: 2026.4.14

TypeError: Cannot Read Properties of Undefined in formatDocsLink During Daemon Installation

The onboard install-daemon command crashes with a TypeError when iterating through channel entries because formatDocsLink does not handle undefined path parameters.

πŸ” Symptoms

The process terminates abruptly during the openclaw onboard --install-daemon workflow when the user sets the channel. The application fails to progress to subsequent configuration steps.

Error Output:

TypeError: Cannot read properties of undefined (reading 'trim')
    at formatDocsLink (links-BlUEqVE8.js:7)
    at resolveChannelSelectionNoteLines (registry-DE4nHTjg.js:111)
    at setupChannels (onboard-channels-D--y_LfI.js:855)

Reproduction Steps:

  1. Execute openclaw onboard --install-daemon
  2. Configure the model (e.g., minimax)
  3. Proceed to set the channel
  4. Observe crash with TypeError

Affected Environment:

  • OS: Windows 11
  • OpenClaw Version: 2026.4.14
  • Install Method: npm global installation
  • Onboard Command: openclaw onboard --install-daemon

🧠 Root Cause

The crash originates from a defensive coding deficiency in the formatDocsLink function within links-BlUEqVE8.js. The function assumes the path parameter is always defined, but a channel entry exists with an undefined meta.docsPath value.

Call Chain Analysis:

  1. Entry Point: onboard-channels-D--y_LfI.js:855 β€” The setupChannels function invokes resolveChannelSelectionNoteLines which iterates through all registered channel entries.
  2. Aggregation: registry-DE4nHTjg.js:111 β€” resolveChannelSetupEntries merges channel entries from three sources:
    • Built-in channels
    • Installed plugins (e.g., WeCom plugin)
    • Directory-based channel entries
  3. Formatting: resolveChannelSelectionNoteLines calls formatChannelSelectionLine(entry.meta, formatDocsLink) for each entry.
  4. Crash Point: links-BlUEqVE8.js:7 β€” formatDocsLink executes path.trim() where path is undefined.

Vulnerability:

javascript // links-BlUEqVE8.js - BEFORE (vulnerable) function formatDocsLink(path, label, opts) { const trimmed = path.trim(); // πŸ’₯ CRASH if path is undefined // … }

The function does not guard against null or undefined values for the path parameter. Channel entries sourced from directory-based registration or incomplete plugin manifests may lack the docsPath property in their metadata object.

πŸ› οΈ Step-by-Step Fix

Option 1: Patch the Distribution File (Immediate Workaround)

Locate and edit the distribution file. The path varies by installation method:

Windows (npm global):

%AppData%\npm\node_modules\openclaw\dist\links-BlUEqVE8.js

macOS/Linux (npm global):

$(npm root -g)/openclaw/dist/links-BlUEqVE8.js

Patch Applied at Line 7:

// links-BlUEqVE8.js - AFTER (patched)
function formatDocsLink(path, label, opts) {
+   if (path == null) return label ?? "";
    const trimmed = path.trim();
    const docsRoot = resolveDocsRoot();
    const url = trimmed.startsWith("http") ? trimmed : `${docsRoot}${trimmed.startsWith("/") ? trimmed : `/${trimmed}`}`;
    // ...
}

Option 2: Identify and Patch the Source Channel

If the missing docsPath originates from a specific channel plugin:

  1. Identify channels with incomplete metadata by examining ~/.openclaw/plugins/ or project-level plugin directories.
  2. Ensure each channel entry defines meta.docsPath in its manifest.
  3. Re-register the affected channel.

Option 3: Wait for Official Patch

Monitor the OpenClaw GitHub repository for version 2026.4.15 or later, which should include this defensive check in the upstream codebase.

πŸ§ͺ Verification

Step 1: Verify the Patch Exists

Check that the null guard is present in formatDocsLink:

# Windows PowerShell
Select-String -Path "$env:AppData\npm\node_modules\openclaw\dist\links-BlUEqVE8.js" -Pattern "if \(path == null\)"

# Expected output: Line containing "if (path == null) return label ?? "";"

Step 2: Re-run the Onboard Command

Execute the full onboard workflow:

openclaw onboard --install-daemon

# Expected: Workflow completes without TypeError
# Proceed through: model setup β†’ channel selection β†’ completion

Step 3: Verify Daemon Installation

Confirm the daemon is running:

# Windows
openclaw daemon status
# Expected: "Daemon is running" or similar

# Check via service
Get-Service -Name OpenClaw* 2>$null
# Expected: Running status

Step 4: Verify Channel Configuration

openclaw config get channels
# Expected: List of configured channels without errors

⚠️ Common Pitfalls

  • Patching the wrong file: Ensure you edit the correct links-BlUEqVE8.js in the active node_modules directory, not a cached or backup copy.
  • Global vs Local installation: If OpenClaw is installed both globally and locally in a project, the local installation may take precedence. Verify with npm list openclaw to determine which installation is active.
  • Plugin directory permissions: On Windows, ensure the plugin directory is writable; otherwise, channel registration may fail silently, leaving entries without docsPath.
  • Cache invalidation: After patching, clear any cached build artifacts:
    npm cache clean --force
    rm -rf node_modules/.cache 2>/dev/null
  • Subsequent updates overwrite patches: Running npm update -g openclaw will overwrite the manual patch. Pin the version or re-apply the patch after updates.
  • Windows Defender interference: Real-time protection may temporarily block edits to files in AppData. Temporarily disable or add an exclusion if write operations fail.
  • Yarn vs npm installations: Yarn may cache packages differently. Use yarn global dir to locate the correct installation path if Yarn was used for installation.
  • TypeError: Cannot read properties of undefined (reading 'startsWith') β€” Similar defensive coding issue in formatDocsLink if path is defined but not a string (e.g., empty object).
  • TypeError: Cannot read properties of null (reading 'trim') β€” Variant of the same bug when path is explicitly null rather than undefined.
  • Channel registration failed: docsPath is required β€” Downstream validation error that would occur if upstream code properly validated channel metadata.
  • openclaw onboard hangs indefinitely on channel selection β€” Related symptom where channel iteration encounters an entry without a docsPath but the error is caught silently.
  • Plugin manifest incomplete: missing required field 'docsPath' β€” Upstream validation error for plugins that should prevent this bug from occurring.

Evidence & Sources

This troubleshooting guide was automatically synthesized by the FixClaw Intelligence Pipeline from community discussions.