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:
- Execute
openclaw onboard --install-daemon - Configure the model (e.g., minimax)
- Proceed to set the channel
- 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:
- Entry Point:
onboard-channels-D--y_LfI.js:855β ThesetupChannelsfunction invokesresolveChannelSelectionNoteLineswhich iterates through all registered channel entries. - Aggregation:
registry-DE4nHTjg.js:111βresolveChannelSetupEntriesmerges channel entries from three sources:- Built-in channels
- Installed plugins (e.g., WeCom plugin)
- Directory-based channel entries
- Formatting:
resolveChannelSelectionNoteLinescallsformatChannelSelectionLine(entry.meta, formatDocsLink)for each entry. - Crash Point:
links-BlUEqVE8.js:7βformatDocsLinkexecutespath.trim()wherepathisundefined.
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.jsmacOS/Linux (npm global):
$(npm root -g)/openclaw/dist/links-BlUEqVE8.jsPatch 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:
- Identify channels with incomplete metadata by examining
~/.openclaw/plugins/or project-level plugin directories. - Ensure each channel entry defines
meta.docsPathin its manifest. - 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 β completionStep 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 statusStep 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.jsin the activenode_modulesdirectory, 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 openclawto 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 openclawwill 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 dirto locate the correct installation path if Yarn was used for installation.
π Related Errors
TypeError: Cannot read properties of undefined (reading 'startsWith')β Similar defensive coding issue informatDocsLinkifpathis defined but not a string (e.g., empty object).TypeError: Cannot read properties of null (reading 'trim')β Variant of the same bug whenpathis explicitlynullrather thanundefined.Channel registration failed: docsPath is requiredβ Downstream validation error that would occur if upstream code properly validated channel metadata.openclaw onboardhangs indefinitely on channel selection β Related symptom where channel iteration encounters an entry without adocsPathbut the error is caught silently.Plugin manifest incomplete: missing required field 'docsPath'β Upstream validation error for plugins that should prevent this bug from occurring.