openclaw - ✅(Solved) Fix [Bug] openclaw configure TypeError: Cannot read properties of undefined (reading 'trim') [4 pull requests, 9 comments, 9 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#66718Fetched 2026-04-15 06:24:46
View on GitHub
Comments
9
Participants
9
Timeline
19
Reactions
5
Timeline (top)
commented ×9cross-referenced ×6referenced ×3subscribed ×1

Error Message

TypeError: Cannot read properties of undefined (reading 'trim') at formatDocsLink (links-BlUEqVE8.js:7:23) at formatChannelSelectionLine (registry-DE4nHTjg.js:111:71) at resolveChannelSelectionNoteLines (onboard-channels-D--y_LfI.js:855:60) at setupChannels (onboard-channels-D--y_LfI.js:1267:24) at configureChannelsSection (configure-CP-Lvt30.js:959:71) at runConfigureWizard (configure-CP-Lvt30.js:1042:6) at configureCommand (configure-CP-Lvt30.js:1134:2)

Fix Action

Fixed

PR fix notes

PR #66727: fix: guard against undefined path in formatDocsLink

Description (problem / solution / changelog)

Summary

Fix TypeError crash in openclaw configure and onboarding when channel docs path is undefined.

Root Cause

formatChannelSelectionLine passes meta.docsPath to formatDocsLink, but docsPath can be undefined for some channels. formatDocsLink calls path.trim() on the undefined value, throwing TypeError: Cannot read properties of undefined (reading 'trim').

Fix

Added nullish coalescing guard (path ?? "") and early return with fallback when trimmed result is empty.

Test Plan

  • openclaw configure wizard no longer crashes on channels without docsPath
  • Onboarding channel selection no longer crashes
  • Existing formatDocsLink callers continue to work

Closes openclaw#66718 Closes openclaw#66693

Changed files

  • src/terminal/links.ts (modified, +5/-3)

PR #66754: fix(terminal): guard formatDocsLink against undefined path

Description (problem / solution / changelog)

Summary

  • Fixes #66718
  • openclaw configure crashed on the Channels section with TypeError: Cannot read properties of undefined (reading 'trim') when a ChannelMeta entry reached formatDocsLink with an undefined/empty `docsPath`.
  • Accept `path: string | undefined | null` and fall back to the docs root when the path is missing, so the configure wizard renders a usable (if generic) docs link instead of throwing.
  • Add `src/terminal/links.test.ts` with regression coverage for the undefined/null paths and the existing shape contracts.

Why

This is a pure defensive fix at the helper: a missing `docsPath` is a latent data bug elsewhere, but the user-facing effect was a wizard crash. Stopping the crash restores the wizard; the underlying data gap is a separate issue.

Test plan

  • `pnpm vitest run src/terminal/links.test.ts` — 6/6 pass
  • `pnpm check` (via pre-commit hook) — green
  • No behavior change for existing callers with a valid `path` (covered by the new absolute / relative / slash-prefix tests)

AI-assisted disclosure

  • AI-assisted (Claude)
  • Testing: fully tested — new unit tests cover the regression plus shape contracts; `pnpm check` green.
  • Prompt context: issue #66718 stack trace, plus reads of `src/terminal/links.ts`, `src/channels/registry.ts` (call site), and `src/channels/plugins/types.core.ts`.
  • I understand what the code does.

Changed files

  • src/terminal/links.test.ts (added, +36/-0)
  • src/terminal/links.ts (modified, +11/-5)

PR #66778: fix: guard against undefined path in formatDocsLink

Description (problem / solution / changelog)

Summary

Fixes TypeError crash in openclaw configure wizard when channel doc links are undefined.

Root Cause

formatDocsLink() in src/terminal/links.ts called path.trim() without checking if path is undefined. When a channel's meta.docsPath is not set, this crashes the configure wizard.

Fix

Changed path.trim() to (path ?? "").trim() — returns empty string fallback, allowing the function to continue gracefully.

Test Plan

  • Unit tests pass
  • openclaw configure wizard no longer crashes on channels with missing docsPath

Closes openclaw#66718

Changed files

  • src/terminal/links.ts (modified, +1/-1)

PR #66882: fix(wizard): guard text-input prompts against undefined clack results

Description (problem / solution / changelog)

Summary

Fixes the widespread onboarding crash:

TypeError: Cannot read properties of undefined (reading 'trim')

that kills openclaw onboard / openclaw configure during channel selection and channel-specific text-input steps (Telegram, Slack, Discord, etc.).

Root cause

@clack/prompts text() can resolve to undefined in some edge cases (e.g. submitting an empty value when neither initialValue nor placeholder is set), even though WizardPrompter.text is declared as Promise<string>. The wrapper in src/wizard/clack-prompter.ts passes the value through guardCancel but does not coerce the non-cancel path, so undefined leaks out to callers. buildChannelSetupWizardAdapterFromSetupWizard in src/channels/plugins/setup-wizard.ts then calls rawValue.trim() directly and crashes.

Fix

  • src/wizard/clack-prompter.ts — enforce the declared Promise<string> contract by coercing nullish results to "" after guardCancel. This covers every prompter.text caller in one place.
  • src/channels/plugins/setup-wizard.ts — belt-and-suspenders rawValue ?? "" at the existing call site so the same symptom can't be reintroduced by a future prompter swap.
  • src/wizard/clack-prompter.test.ts — unit tests for the wrapper covering both the undefined → "" coercion and the string passthrough.

Related issues

  • #66693 [Bug]: While onboarding: TypeError: Cannot read properties of undefined (reading 'trim')
  • #66718 [Bug] openclaw configure TypeError: Cannot read properties of undefined (reading 'trim')
  • #66848 [Bug]: TypeError: Cannot read properties of undefined (reading 'trim')
  • #66677 [Bug]: Select channel (QuickStart)
  • #66624 (closed) same symptom, v2026.4.14
  • #66728 (closed) Skip for now variant
  • #66641 (closed) installer crashes after Select channel (QuickStart)
  • #66619 (closed) Telegram setup variant

Test plan

  • New unit tests in src/wizard/clack-prompter.test.ts pass locally against the patched wrapper.
  • CI: pnpm test:unit / channel plugin tests.
  • Manual: openclaw onboard, pick Telegram, step through the text-input steps without hitting the TypeError.

Changed files

  • src/channels/plugins/setup-wizard-helpers.ts (modified, +7/-7)
  • src/channels/plugins/setup-wizard.ts (modified, +1/-1)
  • src/wizard/clack-prompter.test.ts (modified, +40/-2)
  • src/wizard/clack-prompter.ts (modified, +7/-1)

Code Example

TypeError: Cannot read properties of undefined (reading 'trim')
    at formatDocsLink (links-BlUEqVE8.js:7:23)
    at formatChannelSelectionLine (registry-DE4nHTjg.js:111:71)
    at resolveChannelSelectionNoteLines (onboard-channels-D--y_LfI.js:855:60)
    at setupChannels (onboard-channels-D--y_LfI.js:1267:24)
    at configureChannelsSection (configure-CP-Lvt30.js:959:71)
    at runConfigureWizard (configure-CP-Lvt30.js:1042:6)
    at configureCommand (configure-CP-Lvt30.js:1134:2)
RAW_BUFFERClick to expand / collapse

Bug Description

Running openclaw configure (interactive wizard) crashes with a TypeError when it reaches the Channels section.

Environment

  • OpenClaw version: 2026.4.14 (323493f)
  • macOS: 26.4.1 (arm64)
  • Node: 25.6.1

Steps to Reproduce

  1. Run openclaw configure (interactive wizard)
  2. Navigate to Channels section (or run with --section channels)
  3. Error triggers immediately

Full Error

TypeError: Cannot read properties of undefined (reading 'trim')
    at formatDocsLink (links-BlUEqVE8.js:7:23)
    at formatChannelSelectionLine (registry-DE4nHTjg.js:111:71)
    at resolveChannelSelectionNoteLines (onboard-channels-D--y_LfI.js:855:60)
    at setupChannels (onboard-channels-D--y_LfI.js:1267:24)
    at configureChannelsSection (configure-CP-Lvt30.js:959:71)
    at runConfigureWizard (configure-CP-Lvt30.js:1042:6)
    at configureCommand (configure-CP-Lvt30.js:1134:2)

Gateway Status

Working fine (running, reachable). The bug is limited to the configure wizard.

Suggested Fix

Add null/undefined check in formatDocsLink before calling .trim() on potentially undefined channel doc link.

Impact

Configure wizard fails to launch. All other functionality unaffected.

extent analysis

TL;DR

Adding a null/undefined check in the formatDocsLink function before calling .trim() on the channel doc link is likely to fix the crash.

Guidance

  • Verify that the error occurs specifically when reaching the Channels section in the interactive wizard.
  • Check the formatDocsLink function in links-BlUEqVE8.js to ensure it handles cases where the channel doc link might be undefined or null.
  • Consider adding a default value or an optional chaining operator (?.) to safely navigate the potential null or undefined value before calling .trim().
  • Test the fix by running openclaw configure and navigating to the Channels section to see if the crash is resolved.

Example

// Example of adding a null/undefined check
function formatDocsLink(link) {
  return link ? link.trim() : ''; // or a default value
}

Notes

The suggested fix assumes that the formatDocsLink function is the root cause of the issue, based on the provided error stack. However, without the full codebase, it's difficult to provide a definitive solution.

Recommendation

Apply the workaround by adding a null/undefined check in the formatDocsLink function, as this directly addresses the error message and is a targeted fix for the specific issue described.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug] openclaw configure TypeError: Cannot read properties of undefined (reading 'trim') [4 pull requests, 9 comments, 9 participants]