openclaw - 💡(How to fix) Fix [Bug]: Discord: SecretRef named account token still unresolved at channel startup (2026.5.3) [5 comments, 2 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#77226Fetched 2026-05-05 05:51:01
View on GitHub
Comments
5
Participants
2
Timeline
14
Reactions
2
Timeline (top)
commented ×5mentioned ×3subscribed ×3labeled ×2

SecretRef token for named Discord account fails to resolve at channel startup despite fix in #76987

Error Message

  1. With SecretRef string format (env:default:...): channel startup fails with "unresolved SecretRef" error

Root Cause

SecretRef token for named Discord account fails to resolve at channel startup despite fix in #76987

Fix Action

Fix / Workaround

Workaround: setting the token as a plaintext string in openclaw.json works correctly.

Any user running OpenClaw with a named Discord account (not default) using SecretRef token resolution is affected. The issue occurs every time the gateway starts — it is 100% reproducible. Severity blocks workflow entirely as the Discord channel fails to connect and the bot appears offline. The only workaround is storing the token as plaintext in openclaw.json, which defeats the purpose of secrets management.

Code Example

Gateway logs at startup:

[discord] channel startup failed: channels.discord.accounts.mybot.token:
unresolved SecretRef "env:default:DISCORD_TOKEN_MYBOT".
Resolve this command against an active gateway runtime snapshot before reading it.

With object SecretRef format:

[discord] channel resolve failed; using config entries. Discord API /users/@me/guilds failed (401): 401: Unauthorized
[discord] channel exited: Failed to get gateway information from Discord: Discord API /gateway/bot failed (401): 401: Unauthorized

Token validity confirmed via curl:
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/users/@me → 200 OK
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/gateway/bot → 200 OK
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/users/@me/guilds → 200 OK (returns guild list)

openclaw secrets audit --check shows unresolved=1 for the named account token when gateway is running.
Plaintext token in openclaw.json resolves the issue immediately.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

SecretRef token for named Discord account fails to resolve at channel startup despite fix in #76987

Steps to reproduce

  1. Configure a named Discord account (not default) with a SecretRef token in openclaw.json
  2. Add secrets provider with source "env" and alias "default"
  3. Set the env variable in secrets.env and source it via ~/.bashrc with set -a
  4. Start the gateway via systemd user service
  5. Observe that the Discord channel fails to start

Expected behavior

Discord channel should start successfully and connect to the Discord gateway, with the SecretRef token resolved from the env provider at startup, as stated in the fix #76987.

Actual behavior

Two failure modes observed depending on token format:

  1. With SecretRef string format (env:default:...): channel startup fails with "unresolved SecretRef" error
  2. With object SecretRef format ({source, provider, id}): channel attempts to connect but gets 401 Unauthorized from Discord API (/users/@me/guilds and /gateway/bot), despite the token being valid (confirmed via curl against the same endpoints)

Workaround: setting the token as a plaintext string in openclaw.json works correctly.

OpenClaw version

2026.5.3

Operating system

Linux - Debian (systemd user service)

Install method

npm (global install via npm install -g openclaw)

Model

Model

Provider / routing chain

Not applicable

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Gateway logs at startup:

[discord] channel startup failed: channels.discord.accounts.mybot.token:
unresolved SecretRef "env:default:DISCORD_TOKEN_MYBOT".
Resolve this command against an active gateway runtime snapshot before reading it.

With object SecretRef format:

[discord] channel resolve failed; using config entries. Discord API /users/@me/guilds failed (401): 401: Unauthorized
[discord] channel exited: Failed to get gateway information from Discord: Discord API /gateway/bot failed (401): 401: Unauthorized

Token validity confirmed via curl:
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/users/@me → 200 OK
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/gateway/bot → 200 OK
curl -H "Authorization: Bot <token>" https://discord.com/api/v10/users/@me/guilds → 200 OK (returns guild list)

openclaw secrets audit --check shows unresolved=1 for the named account token when gateway is running.
Plaintext token in openclaw.json resolves the issue immediately.

Impact and severity

Any user running OpenClaw with a named Discord account (not default) using SecretRef token resolution is affected. The issue occurs every time the gateway starts — it is 100% reproducible. Severity blocks workflow entirely as the Discord channel fails to connect and the bot appears offline. The only workaround is storing the token as plaintext in openclaw.json, which defeats the purpose of secrets management.

Additional information

No response

extent analysis

TL;DR

The issue can likely be resolved by re-examining the SecretRef token format and ensuring it matches the expected format for the secrets provider.

Guidance

  • Verify that the SecretRef token is correctly formatted as either a string (env:default:DISCORD_TOKEN_MYBOT) or an object ({source, provider, id}) and that it aligns with the secrets provider's expectations.
  • Check the secrets provider configuration to ensure it is correctly set up to resolve the SecretRef token, especially considering the use of the "env" source and "default" alias.
  • Test the SecretRef token resolution outside of the Discord channel startup process, using tools like openclaw secrets audit --check, to isolate if the issue is specific to the Discord integration or a broader secrets management problem.
  • Consider temporarily using the plaintext token workaround in openclaw.json to confirm that the issue is indeed related to SecretRef token resolution.

Example

No specific code example is provided due to the lack of explicit code references in the issue description.

Notes

The issue seems to be related to the interaction between the secrets management system and the Discord channel configuration. Ensuring that the SecretRef token format and the secrets provider configuration are correctly set up and compatible is crucial.

Recommendation

Apply workaround: Store the token as plaintext in openclaw.json until the SecretRef token resolution issue is fully understood and resolved, as it allows the Discord channel to connect successfully, albeit less securely.

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

Discord channel should start successfully and connect to the Discord gateway, with the SecretRef token resolved from the env provider at startup, as stated in the fix #76987.

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 - 💡(How to fix) Fix [Bug]: Discord: SecretRef named account token still unresolved at channel startup (2026.5.3) [5 comments, 2 participants]