openclaw - ✅(Solved) Fix [Bug]: Slack plugin uses deprecated files.upload API, fails with method_deprecated when sending images/files [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#44544Fetched 2026-04-08 00:45:26
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Participants
Timeline (top)
commented ×2cross-referenced ×2labeled ×2

The Slack channel plugin attempts to upload files/images using the legacy files.upload API, which Slack deprecated and has since disabled. This causes all file/image uploads to fail with method_deprecated.

Error Message

slack tool reply failed: Error: An API error occurred: method_deprecated

Root Cause

Upload fails because the plugin calls the deprecated files.upload endpoint.

Fix Action

Fixed

PR fix notes

PR #2: OpenClaw 紧急未修复

Description (problem / solution / changelog)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: The Gateway crashes with an unhandled promise rejection when the Discord API returns a 503 error, as response.json() is called without checking response.ok.
  • Why it matters: This causes the entire gateway process to exit, leading to a complete service interruption for all connected Discord channels for several minutes.
  • What changed: Added a check for response.ok before attempting to parse the JSON response. Errors are now emitted via this.emitter.emit("error") and this.handleReconnectionAttempt() is called to trigger a graceful reconnection attempt, preventing a full process crash. Updated tests to cover the 503 error path.
  • What did NOT change (scope boundary): Other identified issues (#44544, #44611, #44562, #44549) were either already fixed, determined not to be code bugs, or required a dedicated test environment for safe implementation and are not part of this PR.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #44529
  • Related #

User-visible / Behavior Changes

The gateway will no longer crash when the Discord API returns a 503 error during client registration. Instead, it will log the error and attempt to reconnect gracefully.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Linux (typical Node.js environment)
  • Runtime/container: Node.js
  • Model/provider: N/A
  • Integration/channel (if any): Discord
  • Relevant config (redacted): N/A

Steps

  1. Configure OpenClaw Gateway with a Discord integration.
  2. During the GatewayPlugin.registerClient() call (e.g., when the health monitor triggers a Discord bot reconnection), simulate a Discord API returning a 503 HTTP status code with a non-JSON body.
  3. Observe the gateway process.

Expected

  • The gateway logs an error about the Discord 503 response.
  • The gateway attempts to reconnect to Discord without crashing the entire Node.js process.

Actual

  • The gateway process crashes with an unhandled promise rejection.

Evidence

  • Failing test/log before + passing after (New test should handle 503 response gracefully without crashing added to provider.proxy.test.ts which now passes.)
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Added and passed a new unit test specifically for the 503 error case in provider.proxy.test.ts, ensuring the response.ok check and error handling logic are correctly implemented.
  • Edge cases checked: Specifically addressed the case where response.json() would throw an error on a non-2xx response.
  • What you did not verify: Did not verify in a live production environment with an actual Discord 503 error.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert this PR.
  • Files/config to restore: N/A
  • Known bad symptoms reviewers should watch for: Gateway still crashing on Discord 503, or Discord reconnection issues.

Risks and Mitigations

  • Risk: The error handling or reconnection logic might not fully cover all edge cases of Discord API errors.
    • Mitigation: The current fix addresses the immediate crash by preventing response.json() on bad responses and uses existing reconnection mechanisms. Further monitoring of Discord integration health is always recommended.
<div><a href="https://cursor.com/agents/bc-7023bdfd-1d36-48c0-818c-2346ec9378b5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-7023bdfd-1d36-48c0-818c-2346ec9378b5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> <!-- CURSOR_AGENT_PR_BODY_END -->

Changed files

  • .detect-secrets.cfg (modified, +19/-4)
  • .github/FUNDING.yml (removed, +0/-1)
  • .github/ISSUE_TEMPLATE/bug_report.yml (modified, +31/-0)
  • .github/actions/ensure-base-commit/action.yml (added, +47/-0)
  • .github/actions/setup-node-env/action.yml (modified, +8/-4)
  • .github/actions/setup-pnpm-store-cache/action.yml (modified, +9/-7)
  • .github/codeql/codeql-javascript-typescript.yml (added, +18/-0)
  • .github/pull_request_template.md (modified, +7/-0)
  • .github/workflows/auto-response.yml (modified, +55/-0)
  • .github/workflows/ci.yml (modified, +85/-50)
  • .github/workflows/codeql.yml (added, +134/-0)
  • .github/workflows/docker-release.yml (modified, +77/-10)
  • .github/workflows/install-smoke.yml (modified, +63/-19)
  • .github/workflows/labeler.yml (modified, +256/-82)
  • .github/workflows/openclaw-npm-release.yml (added, +79/-0)
  • .github/workflows/sandbox-common-smoke.yml (modified, +1/-1)
  • .github/workflows/stale.yml (modified, +62/-3)
  • .gitignore (modified, +10/-0)
  • .npmignore (added, +1/-0)
  • .pi/prompts/reviewpr.md (modified, +37/-8)
  • .pre-commit-config.yaml (modified, +27/-1)
  • .secrets.baseline (modified, +229/-316)
  • .swiftformat (modified, +1/-1)
  • .swiftlint.yml (modified, +3/-1)
  • AGENTS.md (modified, +38/-0)
  • CHANGELOG.md (modified, +717/-137)
  • CONTRIBUTING.md (modified, +36/-4)
  • Dockerfile (modified, +165/-50)
  • Dockerfile.sandbox (modified, +6/-3)
  • Dockerfile.sandbox-browser (modified, +7/-5)
  • Dockerfile.sandbox-common (modified, +6/-4)
  • README.md (modified, +1/-1)
  • SECURITY.md (modified, +9/-0)
  • appcast.xml (modified, +499/-328)
  • apps/android/README.md (modified, +1/-1)
  • apps/android/app/build.gradle.kts (modified, +49/-4)
  • apps/android/app/proguard-rules.pro (modified, +1/-1)
  • apps/android/app/src/main/AndroidManifest.xml (modified, +1/-9)
  • apps/android/app/src/main/java/ai/openclaw/android/InstallResultReceiver.kt (removed, +0/-33)
  • apps/android/app/src/main/java/ai/openclaw/android/ScreenCaptureRequester.kt (removed, +0/-65)
  • apps/android/app/src/main/java/ai/openclaw/android/node/AppUpdateHandler.kt (removed, +0/-295)
  • apps/android/app/src/main/java/ai/openclaw/android/node/ScreenHandler.kt (removed, +0/-25)
  • apps/android/app/src/main/java/ai/openclaw/android/node/ScreenRecordManager.kt (removed, +0/-165)
  • apps/android/app/src/main/java/ai/openclaw/app/CameraHudState.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/DeviceNames.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/LocationMode.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/MainActivity.kt (renamed, +3/-7)
  • apps/android/app/src/main/java/ai/openclaw/app/MainViewModel.kt (renamed, +11/-10)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeApp.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeForegroundService.kt (renamed, +6/-28)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt (renamed, +64/-44)
  • apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/SecurePrefs.kt (renamed, +45/-6)
  • apps/android/app/src/main/java/ai/openclaw/app/SessionKey.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/VoiceWakeMode.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/WakeWords.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/chat/ChatModels.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/BonjourEscapes.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceAuthPayload.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceAuthStore.kt (renamed, +4/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceIdentityStore.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayEndpoint.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewaySession.kt (renamed, +225/-20)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayTls.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/InvokeErrorParser.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/A2UIHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CalendarHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CameraCaptureManager.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CameraHandler.kt (renamed, +4/-4)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CanvasController.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/ConnectionManager.kt (renamed, +9/-9)
  • apps/android/app/src/main/java/ai/openclaw/app/node/ContactsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DebugHandler.kt (renamed, +4/-4)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt (renamed, +3/-18)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DeviceNotificationListenerService.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/GatewayEventHandler.kt (renamed, +3/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/node/InvokeCommandRegistry.kt (renamed, +14/-22)
  • apps/android/app/src/main/java/ai/openclaw/app/node/InvokeDispatcher.kt (renamed, +14/-24)
  • apps/android/app/src/main/java/ai/openclaw/app/node/JpegSizeLimiter.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/LocationCaptureManager.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt (renamed, +4/-20)
  • apps/android/app/src/main/java/ai/openclaw/app/node/MotionHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/NodeUtils.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/NotificationsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SmsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SmsManager.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SystemHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/protocol/OpenClawCanvasA2UIAction.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/protocol/OpenClawProtocolConstants.kt (renamed, +1/-12)
  • apps/android/app/src/main/java/ai/openclaw/app/tools/ToolDisplay.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/CameraHudOverlay.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/CanvasScreen.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/ChatSheet.kt (renamed, +3/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/ConnectTabScreen.kt (renamed, +5/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt (renamed, +24/-6)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/MobileUiTokens.kt (renamed, +2/-2)

Code Example

slack tool reply failed: Error: An API error occurred: method_deprecated

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

The Slack channel plugin attempts to upload files/images using the legacy files.upload API, which Slack deprecated and has since disabled. This causes all file/image uploads to fail with method_deprecated.

Steps to reproduce

  1. Configure the Slack channel plugin with a valid bot token that has files:write scope
  2. Ask the agent to send an image or file to a Slack channel
  3. The upload fails

Expected behavior

Files and images should be successfully uploaded to Slack.

Actual behavior

Upload fails because the plugin calls the deprecated files.upload endpoint.

Error in logs:

slack tool reply failed: Error: An API error occurred: method_deprecated

Root Cause: Slack deprecated the files.upload API in 2024. The new API flow requires:

  1. files.getUploadURLExternal — get a pre-signed upload URL
  2. Upload file content directly to that URL
  3. files.completeUploadExternal — finalize and share the file

Verified: bot token has files:write scope and files.getUploadURLExternal returns ok: true.

OpenClaw version

OpenClaw 2026.3.11 (29dc654)

Operating system

N/A (Slack API issue, not OS-specific)

Install method

No response

Model

N/A (Slack channel plugin issue)

Provider / routing chain

N/A (Slack channel plugin issue)

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

References

extent analysis

Fix Plan

To fix the issue, we need to update the Slack channel plugin to use the new files.getUploadURLExternal and files.completeUploadExternal APIs.

Step-by-Step Solution

  1. Update the upload API endpoint:

    • Replace the files.upload endpoint with files.getUploadURLExternal to get a pre-signed upload URL.
    • Use the files.completeUploadExternal endpoint to finalize and share the file after uploading.
  2. Modify the upload logic:

    • First, call files.getUploadURLExternal to get the upload URL.
    • Then, upload the file content directly to the obtained URL.
    • Finally, call files.completeUploadExternal to complete the upload process.

Example Code Snippet

import requests

# Assuming 'token' is your bot token and 'file' is the file to be uploaded
def upload_file_to_slack(token, file):
    # Get the upload URL
    response = requests.post(
        'https://slack.com/api/files.getUploadURLExternal',
        headers={'Authorization': f'Bearer {token}'},
        json={'filename': file.filename, 'content': file.read()}
    )
    upload_url = response.json()['url']

    # Upload the file content directly to the URL
    response = requests.put(upload_url, data=file.read())
    if response.status_code != 200:
        raise Exception('Failed to upload file')

    # Complete the upload
    response = requests.post(
        'https://slack.com/api/files.completeUploadExternal',
        headers={'Authorization': f'Bearer {token}'},
        json={'url': upload_url}
    )
    if not response.json()['ok']:
        raise Exception('Failed to complete upload')

# Usage
token = 'your_bot_token'
file = open('path_to_your_file', 'rb')
upload_file_to_slack(token, file)

Verification

To verify that the fix worked, try uploading a file using the updated plugin. The file should be successfully uploaded to Slack, and you should see no method_deprecated errors in the logs.

Extra Tips

  • Make sure your bot token has the files:write scope.
  • Always check the response from the Slack API to handle any potential errors.
  • Refer to the Slack API documentation for the most up-to-date information on the new API flow.

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

Files and images should be successfully uploaded to Slack.

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 - ✅(Solved) Fix [Bug]: Slack plugin uses deprecated files.upload API, fails with method_deprecated when sending images/files [1 pull requests, 2 comments, 2 participants]