bug: Unexpected token 'o', "ok" is not valid JSON
@zimeg is already working on this.
Since Aug 12, 2026.
Assessment
This issue has not been assessed yet.
Description
Hello and thank you for this action Slack!
Already done a search in both open and closed issues but found none matching my problem. Also looked for open PRs and none fix it either.
When running the GitHub action to notify on failed workflows, as in:
name: Check-Workflow
on:
workflow_run:
workflows: ["*"]
branches: [main]
types:
- completed
jobs:
notify:
runs-on: ubuntu-latest-small
if: github.event.workflow_run.conclusion == 'failure'
permissions:
contents: read
steps:
- name: Slack alert for failure on main
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.1
with:
errors: true
webhook: ${{ secrets.WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
text: "valid text"
It fails with the following error: Error: SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
Full stacktrace is:
Error: SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57
throw new SlackError(config.core, err.message);
^
SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
at Webhook.post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57:1)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:34:1)
at send (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:14:1)
at file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/index.js:9:1
Error: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
at Webhook.post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57:1)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:34:1)
at send (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:14:1)
at file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/index.js:9:1
Some small research with Claude mentioned the following on why it failed:
1. The Slack action posts to the webhook — Slack actually receives it and responds with ok (plain text).
2. But the action expects JSON back, parses "ok" as JSON → Unexpected token 'o', "ok" is not valid JSON.
Hope this is enough context 🤞
Thank you
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 200
- Avg merge
- 2h 59m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from slackapi/slack-github-action
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
slackapi/slack-github-action#667 ·
-
discussion security semver:major
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
slackapi/slack-github-action#621 · 1 comment · 1 reaction ·
-
needs info question
Difficulty 3/5 1-2 days Newbie friendliness 55/100
slackapi/slack-github-action#654 · 7 comments · 5 reactions ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 20/100
slackapi/slack-github-action#520 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
slackapi/slack-github-action#511 · 2 comments · 3 reactions ·
All issues in slackapi/slack-github-action
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
neondatabase/website#5944 ·
-
module: core
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·