openclaw - ✅(Solved) Fix Telegram setup crashes with TypeError: Cannot read properties of undefined (reading 'trim') [3 pull requests, 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#66619Fetched 2026-04-15 06:25:18
View on GitHub
Comments
2
Participants
3
Timeline
14
Reactions
0
Timeline (top)
cross-referenced ×4referenced ×4commented ×2labeled ×2

Running Telegram channel setup fails immediately after the DM policy warning with:

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

Error Message

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

Root Cause

Running Telegram channel setup fails immediately after the DM policy warning with:

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

Fix Action

Workaround

Roll back to 2026.4.5:

npm install -g [email protected]

PR fix notes

PR #66649: fix(wizard): avoid setup crash on missing provider ids

Description (problem / solution / changelog)

## Summary

Prevent setup wizard crashes when provider plugin metadata is incomplete.

The setup flow compares provider ids using .trim(); if a provider entry is missing id, it crashed with TypeError: Cannot read properties of undefined (reading 'trim').

  • Guard provider id comparisons when selecting the preferred provider for an auth choice.
  • Add regression coverage.

Fixes #66641. Fixes #66619.

Test plan

  • pnpm exec vitest run src/wizard/setup.test.ts

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/wizard/setup.test.ts (modified, +56/-0)
  • src/wizard/setup.ts (modified, +9/-3)

PR #66653: fix(telegram): add null safety to .trim() calls in setup flow

Description (problem / solution / changelog)

Summary

Fixes #66619 — Telegram channel setup crashes with TypeError: Cannot read properties of undefined (reading 'trim') immediately after the DM policy warning banner.

What & Why

Multiple .trim() calls in the Telegram setup flow assume their operand is always a string. At runtime, these values can be undefined when the setup wizard encounters edge cases — e.g., a freshly initialized config with no token yet resolved, or a prompter returning undefined.

The previous refactoring in 96fe85fb ("refactor: dedupe telegram trimmed readers") replaced some .trim() calls with normalizeOptionalString() but missed several call sites that still called .trim() directly on potentially-undefined values.

Changes

FileChange
extensions/telegram/src/setup-core.tsGuard normalizeTelegramAllowFromInput against null/undefined raw input
extensions/telegram/src/channel.tsUse (account.token ?? "").trim() for 2 call sites where account.token may be undefined
extensions/telegram/src/doctor.tsUse (account.token ?? "").trim() for 1 call site
src/channels/plugins/setup-wizard-helpers.tsUse (result ?? "").trim() for prompter.text() result
src/channels/plugins/setup-wizard.tsUse (rawValue ?? "").trim() for text input result

Reproduction

  1. Install openclaw v2026.4.14
  2. Run through Telegram channel setup
  3. Error is thrown after the DM policy warning banner

Workaround

Roll back to 2026.4.5: npm install -g [email protected]

AI-Assisted

  • AI-assisted: Yes
  • Degree of testing: Lightly tested (syntax validation passed; full pnpm build && pnpm check && pnpm test not available due to missing esbuild platform binary)
  • Tool: Qoder AI coding assistant
  • I understand what the code does: Yes — each change adds a null coalescing fallback (?? "") or explicit null guard before calling .trim(), ensuring the operation is safe even when the operand is undefined at runtime.

Changed files

  • extensions/telegram/src/channel.ts (modified, +3/-3)
  • extensions/telegram/src/doctor.ts (modified, +1/-1)
  • extensions/telegram/src/setup-core.ts (modified, +3/-0)
  • src/channels/plugins/setup-wizard-helpers.ts (modified, +4/-6)
  • src/channels/plugins/setup-wizard.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')

---

npm install -g openclaw@2026.4.5

---
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

Running Telegram channel setup fails immediately after the DM policy warning with:

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

Steps to reproduce

Steps to reproduce

  1. Install openclaw (latest npm release)
  2. Run through Telegram channel setup
  3. Error is thrown after the DM policy warning banner

Workaround

Roll back to 2026.4.5:

npm install -g [email protected]

Expected behavior

Setup wizard continues past the DM policy warning.

Actual behavior

Process crashes with TypeError: Cannot read properties of undefined (reading 'trim').

OpenClaw version

2026.4.14

Operating system

macOS 26.3 (25D125)

Install method

npm i openclaw

Model

claude-haiku-4-5-20251001

Provider / routing chain

nane

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can likely be resolved by rolling back to a previous version of openclaw, specifically 2026.4.5, as a temporary workaround.

Guidance

  • The error TypeError: Cannot read properties of undefined (reading 'trim') suggests that the code is trying to access a property of an object that is undefined, which may be due to a change in the Telegram channel setup process.
  • To verify the issue, try reproducing the steps with the latest version of openclaw and observe if the error occurs after the DM policy warning banner.
  • The provided workaround of rolling back to 2026.4.5 using npm install -g [email protected] may resolve the issue temporarily.
  • It is recommended to wait for a fix in a future version of openclaw, as rolling back to an older version may introduce other compatibility issues.

Example

No code snippet is provided as the issue does not contain sufficient information to create a minimal example.

Notes

The root cause of the issue is unclear, and the provided workaround may not be a permanent solution. It is recommended to monitor future releases of openclaw for a fix.

Recommendation

Apply workaround: Roll back to 2026.4.5 using npm install -g [email protected], as it is a temporary solution that may resolve the issue until a fix is available in a future 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

Setup wizard continues past the DM policy warning.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING