#error when seting up openclaw wsl ubuntu creating a channel

1 messages · Page 1 of 1 (latest)

lofty karma
#

[openclaw] Failed to start CLI: TypeError: Cannot read properties of undefined (reading 'trim')
at formatDocsLink (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/links-BlUEqVE8.js:7:23)
at formatChannelSelectionLine (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/registry-DE4nHTjg.js:111:71)
at resolveChannelSelectionNoteLines (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/onboard-channels-D--y_LfI.js:855:60)
at setupChannels (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/onboard-channels-D--y_LfI.js:1267:24)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async configureChannelsSection (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/configure-CP-Lvt30.js:959:71)
at async runConfigureWizard (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/configure-CP-Lvt30.js:1042:6)
at async configureCommand (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/configure-CP-Lvt30.js:1134:2)
at async configureCommandFromSectionsArg (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/configure-CP-Lvt30.js:1145:3)
at async Command.<anonymous> (file:///home/pc/.npm-global/lib/node_modules/openclaw/dist/config-cli-ranzgR2T.js:926:3) even after updating to beta and still happened before updating

novel ironBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

wise gardenBOT
thorn veldtBOT
#

Yep, this looks like a real bug, not you and not specifically WSL.

I checked the docs/code path, and there’s already an issue for this exact crash:
https://github.com/openclaw/openclaw/issues/66718

What’s happening:

  • openclaw configure hits the Channels step
  • one channel/plugin entry has no docsPath
  • the CLI calls .trim() on that missing value and crashes

So a beta update may still show it if your build doesn’t include the guard yet.

Can you paste:

openclaw --version
#

For now, the workaround is:

  • avoid the interactive Channels step in configure / onboard
  • configure the channel manually with openclaw config set ...

Docs:

If you want, tell me which channel you’re trying to set up, and I’ll give you the exact openclaw config set commands for that channel.

lofty karma
#

im trying to set up telegram using botfather

thorn veldtBOT
#

Perfect, for Telegram you can skip the broken wizard entirely.

Use manual config instead:

export TELEGRAM_BOT_TOKEN='PASTE_TOKEN_FROM_BOTFATHER'

openclaw config set channels.telegram.enabled true --strict-json
openclaw config set channels.telegram.botToken --ref-provider default --ref-source env --ref-id TELEGRAM_BOT_TOKEN
openclaw config set channels.telegram.dmPolicy pairing
openclaw config validate
openclaw gateway restart

Then:

  1. DM your bot on Telegram
#
  1. check pending pairings:
openclaw pairing list telegram
  1. approve the code:
openclaw pairing approve telegram <CODE>

A couple gotchas:

  • Telegram does not use openclaw channels login telegram
  • for now, avoid openclaw configure / the Channels wizard, that’s the buggy part
  • if you want group support later, BotFather /setprivacy may matter

Docs:

#

If you want, I can also give you the group-chat config right after this so your bot works in Telegram groups too.

lofty karma
#

16:37:36 [telegram] deleteMyCommands failed: Call to 'deleteMyCommands' failed! (401: Unauthorized)
16:37:36 [telegram] deleteWebhook failed: Call to 'deleteWebhook' failed! (401: Unauthorized)
16:37:36 [telegram] [default] channel exited: Call to 'deleteWebhook' failed! (401: Unauthorized)
16:37:36 [telegram] [default] auto-restart attempt 1/10 in 5s
16:37:36 [telegram] setMyCommands failed: Call to 'setMyCommands' failed! (401: Unauthorized)
16:37:36 [telegram] command sync failed: GrammyError: Call to 'setMyCommands' failed! (401: Unauthorized)

thorn veldtBOT
#

This is a different problem, and honestly a better one to have.

401: Unauthorized from deleteWebhook / setMyCommands means OpenClaw is reaching Telegram, but Telegram is rejecting the bot token.

Most likely causes:

  • wrong BotFather token copied
  • old bad token still stored in channels.telegram.botToken
  • you set TELEGRAM_BOT_TOKEN in your shell, but the gateway service is using a different env

Quick checks:

openclaw config get channels.telegram.botToken --json
openclaw channels status --probe

Important detail: for Telegram, config wins over env fallback. So if you ever saved a bad token in config, exporting a good TELEGRAM_BOT_TOKEN won’t fix it.

#

Cleanest setup:

  1. put the raw BotFather token in ~/.openclaw/.env

    TELEGRAM_BOT_TOKEN=123456789:AA...
    
  2. point config at that env var

    openclaw config set channels.telegram.botToken --ref-provider default --ref-source env --ref-id TELEGRAM_BOT_TOKEN
    
  3. restart

    openclaw gateway restart
    openclaw channels status --probe
    
#

Also, make sure the token is just the raw BotFather token:

  • âś… 123456789:AA...
  • ❌ not the bot username
  • ❌ not https://api.telegram.org/bot...
  • ❌ not with an extra bot prefix

If it still says 401 after that, I’d revoke/regenerate the token in BotFather and update it again.

Docs: https://docs.openclaw.ai/channels/telegram

lofty karma
#

pc@DESKTOP-JO959IR:/mnt/c/Users/Pc$ openclaw channels status --probe

🦞 OpenClaw 2026.4.15-beta.2 (29427fe)
I'll do the boring stuff while you dramatically stare at the logs like it's cinema.

│
â—‡
Gateway not reachable: Error: gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/pc/.openclaw/openclaw.json
Bind: loopback
[secrets] channels status: gateway secrets.resolve unavailable (gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/pc/.openclaw/openclaw.json
Bind: loopback); resolved command secrets locally.
Gateway not reachable; showing config-only status.
Config: /home/pc/.openclaw/openclaw.json
Mode: local

  • Telegram default: enabled, configured, mode:polling, token:config

Tip: status --deep adds gateway health probes to status output (requires a reachable gateway).

thorn veldtBOT
#

Nice, this gives us 2 useful clues:

  1. token:config means Telegram is using the token stored in /home/pc/.openclaw/openclaw.json, not an env var.
  2. Gateway not reachable means channels status --probe could only do a config check, not a live Telegram probe.

So I’d do this next:

openclaw gateway status
openclaw gateway restart
openclaw logs --follow

And check the Telegram token source locally:

#
openclaw config get channels.telegram.botToken --json

Don’t paste the token here if it prints the real secret. Just tell me which of these it looks like:

  • raw string like "123456:AA..."
  • env ref like {"source":"env","provider":"default","id":"TELEGRAM_BOT_TOKEN"}

If it’s a raw string, that explains why env changes didn’t help. In that case, repoint it to env with:

openclaw config set channels.telegram.botToken --ref-provider default --ref-source env --ref-id TELEGRAM_BOT_TOKEN
openclaw gateway restart

If you paste openclaw gateway status plus the first few lines from openclaw logs --follow, I can narrow it down fast.

lofty karma
#

{
"source": "env",
"provider": "default",
"id": "TELEGRAM_BOT_TOKEN"
}
pc@DESKTOP-JO959IR:/mnt/c/Users/Pc$ openclaw gateway status

🦞 OpenClaw 2026.4.15-beta.2 (29427fe) — No $999 stand required.

│
â—‡
Service: systemd (enabled)
File logs: /tmp/openclaw/openclaw-2026-04-17.log
Command: /usr/bin/node /home/pc/.nvm/versions/node/v22.22.2/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Service file: ~/.config/systemd/user/openclaw-gateway.service
Service env: OPENCLAW_GATEWAY_PORT=18789

Config (cli): ~/.openclaw/openclaw.json
Config (service): ~/.openclaw/openclaw.json

Gateway: bind=loopback (127.0.0.1), port=18789 (service args)
Probe target: ws://127.0.0.1:18789
Dashboard: http://127.0.0.1:18789/
Probe note: Loopback-only gateway; only local clients can connect.

Runtime: stopped (state activating, sub auto-restart, last exit 1, reason 1)
RPC probe: failed
RPC target: ws://127.0.0.1:18789
gateway closed (1006):

Service is loaded but not running (likely exited immediately).
File logs: /tmp/openclaw/openclaw-2026-04-17.log
Logs: journalctl --user -u openclaw-gateway.service -n 200 --no-pager

Troubles: run openclaw status
Troubleshooting: https://docs.openclaw.ai/troubleshooting

thorn veldtBOT
#

Yep, I think we found it.

Your Telegram config is an env ref:

{"source":"env","provider":"default","id":"TELEGRAM_BOT_TOKEN"}

But your gateway is running as a systemd user service, and its service env only shows:

OPENCLAW_GATEWAY_PORT=18789

So the service likely doesn’t have TELEGRAM_BOT_TOKEN. A shell export TELEGRAM_BOT_TOKEN=... does not automatically reach systemd services.

Fix

#

Put the token in:

~/.openclaw/.env

with a line like:

TELEGRAM_BOT_TOKEN=123456789:AA...

Then restart:

openclaw gateway restart
#

and we can pin down the exact exit reason.

lofty karma
#

16:55:28 [telegram] deleteWebhook failed: Call to 'deleteWebhook' failed! (401: Unauthorized)
16:55:28 [telegram] [default] channel exited: Call to 'deleteWebhook' failed! (401: Unauthorized)
16:55:28 [telegram] [default] auto-restart attempt 1/10 in 5s
16:55:28 [telegram] deleteMyCommands failed: Call to 'deleteMyCommands' failed! (401: Unauthorized)
16:55:28 [telegram] setMyCommands failed: Call to 'setMyCommands' failed! (401: Unauthorized)
16:55:28 [telegram] command sync failed: GrammyError: Call to 'setMyCommands' failed! (401: Unauthorized)

thorn veldtBOT
#

Yep, this is progress.

The env/service part is probably fixed now, because OpenClaw is clearly getting far enough to call Telegram. The remaining error is basically:

Telegram is rejecting the token itself.

So at this point I’d treat it as a bad/mismatched BotFather token.

Next move

  1. In BotFather, generate/copy a fresh token for the exact bot you want.
  2. Replace TELEGRAM_BOT_TOKEN in ~/.openclaw/.env
  3. Restart:
openclaw gateway restart
#

Best sanity check

Run this locally, but don’t paste the token or full URL here:

source ~/.openclaw/.env
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getMe"

Expected result is JSON with "ok":true.

  • If that returns 401 Unauthorized, the token is wrong before OpenClaw even gets involved.
  • If that returns bot info, then we’ve got something stranger, but 99% of the time this is just the wrong token.

Also double-check:

  • it’s the token for the same bot you’re messaging
  • it’s the raw token only, not the bot username
  • no old token is left in ~/.openclaw/.env
#

If getMe returns "ok":true, paste just that fact plus the next openclaw gateway restart result.

lofty karma
#

ok i have set up telegram now but when usinf the config to change the default model in openrouter- who im using it automatically defaults back the openrouter/auto instead of the model i set it to

thorn veldtBOT
#

That’s usually one of 3 things with OpenRouter:

  1. Wrong field

    • the actual default bot model is:
    agents.defaults.model.primary
    

    not a provider-specific “OpenRouter default model” field.

  2. Wrong model ref shape

    • for OpenRouter it must be the full ref:
    openrouter/<provider>/<model>
    

    not just openrouter/<model>

  3. Current chat session is pinned

#
  • if that Telegram chat already has a session model override, changing config won’t change that existing session right away.
    • check in chat with:
    /model status
    

Safest way to set it

openclaw models set openrouter/<provider>/<model>
openclaw models status

Or directly:

openclaw config set agents.defaults.model.primary "openrouter/<provider>/<model>"
lofty karma
#

this is using the openrouter free model after changing it in telgram 18:14:28 [agent/embedded] incomplete turn detected: runId=15d6d868-3761-4efd-a9f8-39910c167fd8 sessionId=b0df21b1-69c9-4d6a-8240-c1c5e7bf0ce9 stopReason=stop payloads=0 — surfacing error to user

thorn veldtBOT
#

Yep, that log is actually useful.

It means the session did use the OpenRouter free model, and that model then stopped without returning any assistant payload:

  • stopReason=stop
  • payloads=0
  • incomplete turn detected

So this is not the same as “it silently switched back to openrouter/auto”.
It looks more like the selected free model itself is flaky for agent turns.

What I’d check

In Telegram, send:

/model status
#

That will tell you the current session model.

Practical takeaway

  • Config default and current chat session model are separate
  • some OpenRouter free models are not reliable for agent/tool use
  • if you want stability, switch this chat to a stronger model, or go back to your configured default

Safe path

  1. Set the default from CLI:
openclaw models set openrouter/<provider>/<model>
openclaw models status
  1. In Telegram, either:
  • run /model <provider/model> for this chat, or
  • start a fresh session if the current one is pinned to the old/free model
lofty karma
#

🦞 OpenClaw 2026.4.15-beta.2 (29427fe) — Open source means you can see exactly how I judge your config.

Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default : openrouter/nvidia/nemotron-3-super-120b-a12b:free
Fallbacks (1) : openrouter/free
Image model : -
Image fallbacks (0): -
Aliases (1) : OpenRouter -> openrouter/auto
Configured models (3): openrouter/auto, openrouter/free, openrouter/nvidia/nemotron-3-super-120b-a12b:free

Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -

  • openrouter effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | openrouter:default=sk-or-v1...1c653835

OAuth/token status

  • none
thorn veldtBOT
#

Ah, nice, this explains it.

Your config did save correctly. The important line is:

Default : openrouter/nvidia/nemotron-3-super-120b-a12b:free

So it is not resetting your default back to openrouter/auto.

What’s confusing it is the next lines:

Fallbacks (1) : openrouter/free
Aliases (1)   : OpenRouter -> openrouter/auto
Configured models (3): openrouter/auto, openrouter/free, openrouter/nvidia/nemotron-3-super-120b-a12b:free
#

What that means

  • OpenRouter alias still points to openrouter/auto
  • if your chosen model fails, OpenClaw can fall back to openrouter/free
  • because openrouter/auto is still in your configured models list, it still shows up as a valid option/alias

If you want only your chosen model

You should clean up 2 things:

  1. remove/change the fallback:
agents.defaults.model.fallbacks
  1. remove openrouter/auto from:
agents.defaults.models
#

Otherwise the alias OpenRouter -> openrouter/auto will keep existing.

Short version

Your setup is currently behaving as configured, just not as intended.

If you want, paste your redacted agents.defaults block and I’ll tell you the exact lines to remove so it stops offering openrouter/auto and openrouter/free.

lofty karma
#

how to remove it

thorn veldtBOT
#

If you want to remove the auto alias and the generic free fallback, run:

openclaw config unset agents.defaults.model.fallbacks
openclaw config unset 'agents.defaults.models["openrouter/auto"]'
openclaw config unset 'agents.defaults.models["openrouter/free"]'
openclaw gateway restart
openclaw models status

What those do:

  • fallbacks → removes openrouter/free
  • models["openrouter/auto"] → removes the OpenRouter -> openrouter/auto alias
  • models["openrouter/free"] → removes the generic free model from the picker/allowlist

After that, your remaining default should just be your exact model.

#

If the current Telegram chat still uses the old one, that chat may be session-pinned, so either:

  • run /model status
  • then switch it again in chat, or
  • start a fresh session

Docs:

If config unset complains about the quoted path, paste the error and I’ll give you the exact alternate syntax.

lofty karma
#

Config path not found: agents.defaults.models["openrouter/auto"]

🦞 OpenClaw 2026.4.15-beta.2 (29427fe) — I autocomplete your thoughts—just slower and with more API calls.

Config path not found: agents.defaults.models["openrouter/free"]

thorn veldtBOT
#

Yep, that error means those two entries are not explicit keys in your config, so there’s nothing to unset there.

So the useful cleanup is just this:

openclaw config unset agents.defaults.model.fallbacks
openclaw gateway restart
openclaw models status

Then in Telegram, set the exact model ref again, not the OpenRouter alias:

/model openrouter/nvidia/nemotron-3-super-120b-a12b:free
/model status
#

So the short version is:

  • openrouter/auto / openrouter/free are not stored as direct config paths in your file
  • the one thing you can remove is the fallback list
  • then switch the chat to the exact model ref

If you want, run this too and paste it:

openclaw config get agents.defaults.models --json

That’ll show whether you have a real model allowlist at all, or if this is just session alias/fallback behavior.