openclaw - ✅(Solved) Fix nextcloud-talk channel returns 400 "Invalid payload format" on non-message Talk events (file shares) [1 pull requests, 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#81566Fetched 2026-05-14 03:30:48
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
cross-referenced ×2commented ×1

The @openclaw/nextcloud-talk webhook handler rejects non-message Talk events (file shares, share-link cards, etc.) with HTTP 400 Invalid payload format instead of acknowledging them silently. This pollutes the Nextcloud server log with stack traces every time a user shares a file in a room that has an OpenClaw bot installed, even though the bot was never expected to act on those events.

Error Message

"app":"spreed", "url":"/ocs/v2.php/apps/files_sharing/api/v1/shares", "message":"Bot error occurred, increasing error count", "exception":{ "Exception":"GuzzleHttp\Exception\ClientException", "Message":"Client error: POST http://<bot>:8788/nextcloud-talk-webhook resulted in a 400 Bad Request response:\n{"error":"Invalid payload format"}" }

Root Cause

The @openclaw/nextcloud-talk webhook handler rejects non-message Talk events (file shares, share-link cards, etc.) with HTTP 400 Invalid payload format instead of acknowledging them silently. This pollutes the Nextcloud server log with stack traces every time a user shares a file in a room that has an OpenClaw bot installed, even though the bot was never expected to act on those events.

Fix Action

Fix / Workaround

  1. Install OpenClaw nextcloud-talk channel and register the bot via occ talk:bot:install against an existing room.
  2. From the Nextcloud Talk client (iOS/web), share a file into the room (POST /ocs/v2.php/apps/files_sharing/api/v1/shares with shareType=10 / Talk).
  3. Nextcloud's spreed app dispatches the webhook to the bot endpoint.
  4. The bot responds 400 Bad Request with body {"error":"Invalid payload format"}.
  5. Nextcloud logs Bot error occurred, increasing error count with a Guzzle stack trace.

PR fix notes

PR #81569: fix(nextcloud-talk): ignore signed non-message webhooks

Description (problem / solution / changelog)

Summary

  • parse signed webhook JSON before applying the strict chat-message schema
  • acknowledge signed non-message Talk Activity Streams events without invoking the message handler
  • keep malformed JSON and malformed supported message payloads on the existing 400 Invalid payload format path

Fixes #81566.

Verification

  • pnpm exec oxfmt --check extensions/nextcloud-talk/src/monitor.ts extensions/nextcloud-talk/src/monitor.replay.test.ts
  • pnpm vitest run extensions/nextcloud-talk/src/monitor.replay.test.ts
  • pnpm check:changed
  • git diff --check

Real behavior proof

Behavior addressed: Before this patch, a signed valid JSON Nextcloud Talk webhook whose Activity Streams object was not a chat-message Note failed the strict message schema and returned HTTP 400 Invalid payload format. After this patch, the webhook handler distinguishes malformed JSON / malformed supported message payloads from signed non-message Talk events, acknowledges the latter, and skips onMessage.

Real setup tested: Local OpenClaw checkout at /home/chenglunhu/code/openclaw, branch fix/nextcloud-talk-ignore-non-message-events-81566, commit 8418995537fc5f419f5aa11aa38e4976ad7b3d61, using the real extensions/nextcloud-talk/src/monitor.ts webhook server through pnpm exec tsx.

Exact steps or command run after the patch: Started createNextcloudTalkWebhookServer on 127.0.0.1:18788 with the real signature verifier and sent two signed requests: a non-message Document event shaped like a Talk file-share event, then malformed JSON.

Evidence after fix: Terminal output from the live command:

{
  "nonMessageStatus": 200,
  "nonMessageBody": "",
  "malformedStatus": 400,
  "malformedBody": "{\"error\":\"Invalid payload format\"}",
  "onMessageCalls": 0
}

Observed result after fix: The signed non-message event returned 200 with an empty body and did not invoke the message handler. The signed malformed JSON request still returned 400 Invalid payload format, preserving the useful bad-request signal.

Not tested: I did not run a live Nextcloud 33/Talk instance; this proof exercises the real OpenClaw webhook server locally with signed HTTP requests.

Changed files

  • extensions/nextcloud-talk/src/monitor.replay.test.ts (modified, +107/-9)
  • extensions/nextcloud-talk/src/monitor.ts (modified, +49/-5)

Code Example

"app":"spreed",
"url":"/ocs/v2.php/apps/files_sharing/api/v1/shares",
"message":"Bot error occurred, increasing error count",
"exception":{
  "Exception":"GuzzleHttp\\Exception\\ClientException",
  "Message":"Client error: `POST http://<bot>:8788/nextcloud-talk-webhook` resulted in a `400 Bad Request` response:\n{\"error\":\"Invalid payload format\"}"
}
RAW_BUFFERClick to expand / collapse

Summary

The @openclaw/nextcloud-talk webhook handler rejects non-message Talk events (file shares, share-link cards, etc.) with HTTP 400 Invalid payload format instead of acknowledging them silently. This pollutes the Nextcloud server log with stack traces every time a user shares a file in a room that has an OpenClaw bot installed, even though the bot was never expected to act on those events.

Environment

  • @openclaw/nextcloud-talk: 2026.5.7
  • openclaw: 2026.5.7
  • Nextcloud: 33.0.2.2
  • Nextcloud Talk (spreed): version shipped with NC 33.0.2 (Talk client v23.0.2)
  • Node: 24-alpine
  • Bot features: webhook, response

Reproduction

  1. Install OpenClaw nextcloud-talk channel and register the bot via occ talk:bot:install against an existing room.
  2. From the Nextcloud Talk client (iOS/web), share a file into the room (POST /ocs/v2.php/apps/files_sharing/api/v1/shares with shareType=10 / Talk).
  3. Nextcloud's spreed app dispatches the webhook to the bot endpoint.
  4. The bot responds 400 Bad Request with body {"error":"Invalid payload format"}.
  5. Nextcloud logs Bot error occurred, increasing error count with a Guzzle stack trace.

Observed log (Nextcloud side)

"app":"spreed",
"url":"/ocs/v2.php/apps/files_sharing/api/v1/shares",
"message":"Bot error occurred, increasing error count",
"exception":{
  "Exception":"GuzzleHttp\\Exception\\ClientException",
  "Message":"Client error: `POST http://<bot>:8788/nextcloud-talk-webhook` resulted in a `400 Bad Request` response:\n{\"error\":\"Invalid payload format\"}"
}

The same Invalid payload format is also raised on occ talk:bot:setup against a fresh room (likely the setup ping carries a payload shape the handler does not recognize).

Expected behavior

For Talk events the bot is not interested in (or whose schema does not parse), the channel handler should:

  • Return HTTP 200 with an empty body (or 204), so Nextcloud does not increment error_count and does not log a stack trace.
  • Optionally log at debug level on the bot side that an unknown payload variant was skipped.

The relevant chain is in dist/channel-*.js (WEBHOOK_ERRORS.invalidPayloadFormat) — currently any Zod parse miss returns 400 regardless of whether the event is a chat message the bot is meant to handle.

Impact

  • Chat replies still work (error_count is reset on the next successful chat round-trip), but the bot looks unhealthy in occ talk:bot:list output if a burst of file shares lands.
  • Nextcloud admin log fills up quickly in active rooms; real bot errors get drowned out.
  • If error_count crosses the auto-disable threshold before the next chat message resets it, Talk may move the bot to state=0 and silently stop delivering messages.

Suggested fix

Treat schema mismatch as a non-fatal "not for this bot" condition: when the inbound payload does not match the expected chat-message schema, respond 200 and return early, instead of mapping to invalidPayloadFormat → 400. Keep the 400 path for genuinely malformed JSON / missing signature headers (which are still useful signals).

Happy to send a PR if the maintainers agree on the contract.

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

For Talk events the bot is not interested in (or whose schema does not parse), the channel handler should:

  • Return HTTP 200 with an empty body (or 204), so Nextcloud does not increment error_count and does not log a stack trace.
  • Optionally log at debug level on the bot side that an unknown payload variant was skipped.

The relevant chain is in dist/channel-*.js (WEBHOOK_ERRORS.invalidPayloadFormat) — currently any Zod parse miss returns 400 regardless of whether the event is a chat message the bot is meant to handle.

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 nextcloud-talk channel returns 400 "Invalid payload format" on non-message Talk events (file shares) [1 pull requests, 1 comments, 2 participants]