openclaw - 💡(How to fix) Fix [Bug]: tools array empty at Anthropic provider despite 17 tools computed in attempt.ts (Telegram channel) [1 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#74377Fetched 2026-04-30 06:24:42
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
labeled ×2commented ×1

When using OpenClaw via Telegram channel, the Anthropic API receives tools:[] even though attempt.ts confirms tools post-normalize length=17. The agent generates tool_use as plain text instead of actual API tool_use blocks.

Root Cause

context.tools arrives as array(len=0) at the Anthropic provider, even though attempt.ts confirms tools post-normalize length=17 (exec, read, write, edit, web_search...). The agent generates tool_use as plain text instead of actual API tool_use blocks because tools:[] is sent to Anthropic API.

Fix Action

Fix / Workaround

Debug patches added to attempt.ts and pi-ai/anthropic.js confirmed:

Related issues: #23748, #26416, #18177
Workarounds tried: elevated.allowFrom, exec.security=full, yolo preset, elevated.enabled=false, agents.list removed, model change opus→sonnet, session cache cleared. None work.
The bug is in the runner between attempt.ts:666 and the transport layer.

Code Example

Debug patches added to attempt.ts and pi-ai/anthropic.js confirmed:

[ATT_DEBUG] toolsEnabled=true toolsRaw.length=17 names=read,edit,write,exec,process...
[ATT_DEBUG] tools post-normalize length=17
[MAX_DEBUG_PIAI] context.tools=array(len=0,names=)

Tools are correctly built in attempt.ts but arrive empty at the Anthropic provider.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

When using OpenClaw via Telegram channel, the Anthropic API receives tools:[] even though attempt.ts confirms tools post-normalize length=17. The agent generates tool_use as plain text instead of actual API tool_use blocks.

Steps to reproduce

  1. Configure OpenClaw 2026.4.22 on macOS (Apple Silicon M2) with Telegram channel
  2. Set tools.profile: "coding", tools.exec: {security: "full", ask: "off"}, tools.elevated.allowFrom.telegram: ["<user_id>"]
  3. Send any DM to the bot from Telegram
  4. Ask the agent to execute a bash command

Expected behavior

  1. Configure OpenClaw 2026.4.22 on macOS (Apple Silicon M2) with Telegram channel
  2. Set tools.profile: "coding", tools.exec: {security: "full", ask: "off"}, tools.elevated.allowFrom.telegram: ["<user_id>"]
  3. Send any DM to the bot from Telegram
  4. Ask the agent to execute a bash command

Actual behavior

context.tools arrives as array(len=0) at the Anthropic provider, even though attempt.ts confirms tools post-normalize length=17 (exec, read, write, edit, web_search...). The agent generates tool_use as plain text instead of actual API tool_use blocks because tools:[] is sent to Anthropic API.

Debug evidence: [ATT_DEBUG] toolsEnabled=true toolsRaw.length=17 [ATT_DEBUG] tools post-normalize length=17 [MAX_DEBUG_PIAI] context.tools=array(len=0,names=)

Tried: elevated.allowFrom, exec.security=full, ask=off, yolo preset, elevated.enabled=false, agents.list removed, model change opus→sonnet, session cache cleared. Nothing works.

Related: #23748, #26416, #18177

OpenClaw version

2026.4.22

Operating system

macOS 15 (Apple Silicon M2 Pro)

Install method

pnpm dev

Model

anthropic/claude-opus-4-7 (also tested with anthropic/claude-sonnet-4-6)

Provider / routing chain

openclaw -> anthropic (direct API key)

Additional provider/model setup details

Direct Anthropic API key configured. No proxy or gateway. tools.profile: "coding", tools.exec: {security: "full", ask: "off"}, tools.elevated.allowFrom.telegram: ["1094268485"]

Logs, screenshots, and evidence

Debug patches added to attempt.ts and pi-ai/anthropic.js confirmed:

[ATT_DEBUG] toolsEnabled=true toolsRaw.length=17 names=read,edit,write,exec,process...
[ATT_DEBUG] tools post-normalize length=17
[MAX_DEBUG_PIAI] context.tools=array(len=0,names=)

Tools are correctly built in attempt.ts but arrive empty at the Anthropic provider.

Impact and severity

Affected: All users using Telegram channel with tools/exec enabled Severity: High (blocks all tool execution from Telegram) Frequency: Always (100% reproducible) Consequence: Agent cannot execute any bash commands, read/write files, or use any tools via Telegram

Additional information

Related issues: #23748, #26416, #18177 Workarounds tried: elevated.allowFrom, exec.security=full, yolo preset, elevated.enabled=false, agents.list removed, model change opus→sonnet, session cache cleared. None work. The bug is in the runner between attempt.ts:666 and the transport layer.

extent analysis

TL;DR

The issue can be resolved by investigating and fixing the data transfer between attempt.ts and the Anthropic API, ensuring that the tools array is correctly passed.

Guidance

  • Review the code in attempt.ts and pi-ai/anthropic.js to identify where the tools array is being modified or overwritten, causing it to arrive empty at the Anthropic provider.
  • Verify that the tools array is correctly built and normalized in attempt.ts before being sent to the Anthropic API.
  • Check the transport layer and API request payload to ensure that the tools array is being sent correctly and not being modified or lost during transmission.
  • Investigate the related issues (#23748, #26416, #18177) to see if they provide any clues or insights into the problem.

Example

No code snippet is provided as the issue is more related to debugging and investigating the data flow between components.

Notes

The issue seems to be specific to the interaction between OpenClaw and the Anthropic API, and the provided debug evidence suggests that the tools array is being correctly built in attempt.ts but arrives empty at the Anthropic provider. Further investigation is needed to identify the root cause of the issue.

Recommendation

Apply a workaround by manually verifying and logging the tools array at each stage of the data flow to identify where it is being modified or lost, and then fix the issue accordingly.

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

  1. Configure OpenClaw 2026.4.22 on macOS (Apple Silicon M2) with Telegram channel
  2. Set tools.profile: "coding", tools.exec: {security: "full", ask: "off"}, tools.elevated.allowFrom.telegram: ["<user_id>"]
  3. Send any DM to the bot from Telegram
  4. Ask the agent to execute a bash command

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]: tools array empty at Anthropic provider despite 17 tools computed in attempt.ts (Telegram channel) [1 comments, 2 participants]