#Invalid config message

1 messages · Page 1 of 1 (latest)

formal fractal
#

Invalid config:

  • channels.telegram.groupPolicy: Invalid option: expected one of "open"|"disabled"|"allowlist"
mystic irisBOT
#

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

visual thicketBOT
#

That error just means your channels.telegram.groupPolicy value is not one of the allowed group policies.

For groups, groupPolicy only supports:

  • "open"
  • "disabled"
  • "allowlist" (default)

If you were trying to use pairing, that’s DM-only and belongs under channels.telegram.dmPolicy, not groupPolicy.

Example (pairing for DMs, allowlist groups, allow all groups but require @mention):

{
  channels: {
    telegram: {
#

If you paste the current snippet where you set channels.telegram.groupPolicy (and what behavior you want in groups), I can tell you the exact correct setting. Also worth including openclaw --version in case you’re on an older config schema.

formal fractal
#

What is the command that I should use in the terminal to tell you that?

visual thicketBOT
#

Run these and paste the output here (redact secrets like botToken):

openclaw --version
openclaw doctor
openclaw config get channels.telegram.groupPolicy
openclaw config get channels.telegram.dmPolicy
openclaw config get channels.telegram.groups

If openclaw config get … doesn’t work for some reason, just paste the relevant section from your config file instead:

cat ~/.openclaw/openclaw.json

(Again: please redact botToken / any API keys before posting.)

formal fractal
#

They all give me the same error: Config invalid
File: ~/.openclaw/openclaw.json
Problem:

  • channels.telegram.groupPolicy: Invalid option: expected one of "open"|"disabled"|"allowlist"
visual thicketBOT
#

Yep — once the config is invalid, a bunch of commands will refuse to run because they load + validate ~/.openclaw/openclaw.json first.

Fast way forward is: find the actual value you set and change it manually to one of the allowed strings.

1) Show me what it’s currently set to

Run:

grep -n "groupPolicy" ~/.openclaw/openclaw.json

Paste the output here (it should just be a line or two).

2) Fix it (manual edit)

Edit ~/.openclaw/openclaw.json and set:

#
groupPolicy: "allowlist" // or "open" or "disabled"

Common gotcha: people put "pairing" here — that’s DM-only and should be:

dmPolicy: "pairing"

3) Re-run validation

After editing:

openclaw doctor
#

If you paste the grep output, I can tell you exactly what to change it to (and where).

formal fractal
#

89: "groupPolicy": "all",

visual thicketBOT
#

There it is — "all" isn’t a valid value.

Change:

"groupPolicy": "all",

to one of the valid options:

  • allow all groups:
    "groupPolicy": "open",
    
  • disable groups entirely:
#
  "groupPolicy": "disabled",
  • safest default (only groups you list under channels.telegram.groups, * wildcard allowed):
    "groupPolicy": "allowlist",
    

After you edit, run:

openclaw doctor

and then restart the gateway (if it wasn’t running).

If this fixes it, please mark the solution (right-click message → Apps → ✅ Mark Solution) so Answer Overflow can index it.

formal fractal
#

Can you explain the difference of those settings? I want to make sure that I set to the correct one

visual thicketBOT
#

Yep — groupPolicy is basically “should OpenClaw even consider group chats, and if yes, which ones?”

groupPolicy: "disabled"

No group handling at all.
Group messages are dropped/ignored, and the bot won’t reply in groups.

Use this if you only want DMs.


groupPolicy: "allowlist" (default + safest)

Only groups you explicitly allow are eligible for replies.

You “allow” groups via channels.telegram.groups, e.g.:

#
channels: {
  telegram: {
    groupPolicy: "allowlist",
    groups: {
      "1234567890": { requireMention: true }, // one specific group id
      // or:
      "*": { requireMention: true }, // allow all groups (but still “intentional” in config)
    },
  },
},

This is the best setting if you want to avoid the bot unexpectedly becoming active in random groups.


#

groupPolicy: "open"

All groups are eligible (no allowlisting step).

This is “I don’t want to manage a group allowlist”. You’ll usually still want requireMention: true (globally/per-group) so it doesn’t reply to everything.


Important related knobs (often confused with groupPolicy)

  • requireMention: controls whether a message triggers a reply vs just being stored for context.
  • groupAllowFrom: controls who is allowed to trigger the bot inside groups (even if the group itself is allowed).

What you probably want

  • “Only my groups / I want control”: allowlist + list group ids (or * if you really do want all).
  • “Any group is fine, but don’t be noisy”: open + requireMention: true.
  • “Never respond in groups”: disabled.
#

Tell me your goal (1–2 sentences: “DMs only”, “some groups”, “any group but only when mentioned”, “only I can trigger in groups”), and I’ll suggest the tightest config.

formal fractal
#

DM's only

visual thicketBOT
#

Cool — for DMs only, set:

  • channels.telegram.groupPolicy: "disabled" (turn off groups entirely)
  • and pick your DM access policy via channels.telegram.dmPolicy

A solid “DM me only” config is:

{
  channels: {
    telegram: {
      enabled: true,
      botToken: "123:abc",

      // DMs:
      dmPolicy: "allowlist",
#
      allowFrom: ["tg:YOUR_NUMERIC_TELEGRAM_ID"],

      // Groups:
      groupPolicy: "disabled",
    },
  },
}

If you prefer “first DM requires approval, then it works” instead, use:

dmPolicy: "pairing"

(and you don’t need allowFrom in that mode).

#

Once you set groupPolicy: "disabled", the bot won’t reply in Telegram groups at all.

formal fractal
#

Okay to be clear, I want the bot to reply to me in Telegram when I message from telegram, but when I message in the UI chat, I want the bot to only respond in the chat.

visual thicketBOT
#

What you want is doable — the key is making sure Telegram DMs and Control UI chat are not the same “direct chat session.”

By default, OpenClaw can collapse all DMs into the agent’s main session (session.dmScope: "main"). That’s great for continuity, but it can make the Control UI feel “tied” to whatever DM channel you used last.

Recommended config for “Telegram DM replies in Telegram, UI replies stay in UI”

Set DM sessions to be separate per channel:

{
  session: {
    dmScope: "per-channel-peer",
  },

  channels: {
    telegram: {
      enabled: true,
#
      botToken: "123:abc",

      dmPolicy: "allowlist",
      allowFrom: ["tg:YOUR_NUMERIC_TELEGRAM_ID"],

      groupPolicy: "disabled",
    },
  },
}

Now you’ll effectively have:

  • a Telegram DM session (replies go to Telegram)
  • a Control UI chat session (replies stay in the UI)

One important UI note

#

In the Control UI you can select different sessions. If you open the Telegram DM session in the UI and type there, you’re essentially “talking into that Telegram conversation”, so it may (by design) deliver replies to Telegram.

If you want “UI-only”, make sure you’re chatting in the UI/main session, not the Telegram DM session.

If you tell me whether you want the same conversation context shared between Telegram + UI (or you’re fine with them being separate), I can suggest the best dmScope variant (per-peer vs per-channel-peer).

formal fractal
#

I want the context shared between telegram and the UI.

visual thicketBOT
#

Then you actually want the default DM behavior: keep everything in the agent’s main session so the transcript/context is shared.

What to set

Use:

  • session.dmScope: "main" (this is the default — you can omit it)
  • Telegram groups off (since you said DMs only): channels.telegram.groupPolicy: "disabled"
  • Telegram DM access as you prefer (pairing or allowlist)

Example:

{
  session: {
    dmScope: "main", // optional; this is the default
  },
#
  channels: {
    telegram: {
      enabled: true,
      botToken: "123:abc",

      dmPolicy: "allowlist",
      allowFrom: ["tg:YOUR_NUMERIC_TELEGRAM_ID"],

      groupPolicy: "disabled",
    },
  },
}

About “UI chat should only reply in the UI”

That’s how it’s intended to work: replies go back to the surface that sent the message (Telegram DM → Telegram; Control UI chat → Control UI), even if they share the same underlying session/context.

#

If you do see UI messages causing Telegram messages, it usually means you’re effectively “chatting as” the Telegram DM conversation (i.e. the UI is focused on that session/origin). Tell me what you see in the Control UI session selector (which session key you’re chatting in), and I can point to the exact fix.

formal fractal
#

What should I type in to the terminal to make this change?

visual thicketBOT
#

If your config currently validates (i.e. openclaw doctor runs), the clean way is via openclaw config set:

openclaw config set session.dmScope "main"
openclaw config set channels.telegram.groupPolicy "disabled"

Then sanity-check:

openclaw doctor

If openclaw config set … still refuses to run because the config is invalid, edit the file directly instead:

#
nano ~/.openclaw/openclaw.json
# (or: vim ~/.openclaw/openclaw.json)

Make the same two edits in the JSON5, save, then rerun:

openclaw doctor
formal fractal
#

How do I save this in vs code after making the updates

visual thicketBOT
#

In VS Code, once you’ve edited ~/.openclaw/openclaw.json, just:

  • Mac: Cmd + S
  • Windows/Linux: Ctrl + S
  • Or: File → Save

You’ll know it saved when the little “•” (unsaved indicator) on the tab title disappears.

Optional: turn on auto-save via File → Auto Save (then it saves automatically after a short delay).

formal fractal
#

I must have done it wrong because it says: Error: Config validation failed: channels.telegram.groupPolicy: Invalid option: expected one of "open"|"disabled"|"allowlist"

visual thicketBOT
#

That error means the config still contains a channels.telegram.groupPolicy value that is not exactly one of:

"open", "disabled", "allowlist" (lowercase, spelled exactly like that).

Quick check: what does your file currently contain?

Run:

grep -n '"groupPolicy"' ~/.openclaw/openclaw.json

Paste the output here.

For “DMs only”, it should look like this

Somewhere under channels.telegram:

#
groupPolicy: "disabled",

Common mistakes I see:

  • "all" (what you had before)
  • "disable" / "off" / "false"
  • "Disabled" (capitalization matters)

Paste that grep output and I’ll tell you which exact line to change.

formal fractal
#

Okay now it says: - channels.telegram.allowFrom: channels.telegram.dmPolicy="allowlist" requires channels.telegram.allowFrom to contain at least one sender ID

visual thicketBOT
#

Nice — that means groupPolicy is fixed and validation moved on.

Now you’ve set:

  • channels.telegram.dmPolicy: "allowlist"
  • but you didn’t provide any channels.telegram.allowFrom entries

OpenClaw rejects that because an empty allowlist would lock you out.

Fix (pick one)

Option A (easiest for “just me”): use pairing

No allowFrom needed:

channels: {
#
  telegram: {
    dmPolicy: "pairing",
    // remove allowFrom
  },
}

Then after starting the gateway, you DM the bot once, and approve yourself via pairing.


Option B (strict, no pairing prompts): keep allowlist + add your Telegram user id

channels: {
  telegram: {
#
    dmPolicy: "allowlist",
    allowFrom: ["tg:123456789"], // your numeric Telegram user id
  },
}

To get your numeric Telegram user id quickly, message @userinfobot in Telegram (it replies with your ID), then paste that number into allowFrom.

After editing, run:

openclaw doctor

If you tell me which option you prefer (pairing vs strict allowlist), I can give you the exact minimal telegram block to paste.

formal fractal
#

pairing is fine

visual thicketBOT
#

Cool — then switch Telegram DMs to pairing and you can drop the allowlist entirely.

1) Update your config

In ~/.openclaw/openclaw.json:

{
  session: { dmScope: "main" }, // shared context with Control UI

  channels: {
    telegram: {
      enabled: true,
      botToken: "123:abc",

      dmPolicy: "pairing",
      groupPolicy: "disabled",
#

      // remove allowFrom (not needed for pairing)
    },
  },
}

Save the file, then verify it’s clean:

openclaw doctor

2) Start / restart the gateway

If you run it in the foreground:

#
openclaw gateway

If you installed it as a service:

openclaw gateway restart

3) Pair your Telegram DM

  1. DM your bot on Telegram (it should reply with a pairing code)
  2. In the terminal:
openclaw pairing list telegram