[GOWS] - Channel info / preview by @newsletter id crashes with nil pointer (500) for channels the session does not follow

Open
#2,367 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go, typescript
Domain
api, backend

Research direction

Start with the GOWS channel info and preview handlers, then trace how they call gows-plus src/server/newsletter.go and its GetNewsletterInfo function. Reproduce with an unfollowed channel’s @newsletter id and compare with an invite code or followed channel. Done means both endpoints return channel data or a useful 4xx error instead of HTTP 500; the implementation is in the external gows-plus dependency.

Written by the indexing model from the issue text.

Description

Describe the bug

On GOWS, GET /api/{session}/channels/{id} and GET /api/{session}/channels/{id}/messages/preview crash with a nil pointer (HTTP 500) when {id} is a ...@newsletter id of a channel the session does not follow. The same calls work with the channel's invite code, and work by @newsletter id for channels the session follows.

Version
{
  "version": "2026.10.1",
  "engine": "GOWS",
  "tier": "CORE"
}

Image devlikeapro/waha:gows-2026.10.1 (linux/amd64), also seen on arm-2026.10.1. GOWS gows-plus v1.0.49.

Steps

  1. A WORKING GOWS session (default) that does not follow the official WhatsApp channel.
  2. GET /api/default/channels/120363144038483540@newsletter
  3. GET /api/default/channels/120363144038483540@newsletter/messages/preview?limit=3&downloadMedia=false
Expected behavior

The channel info and its latest posts (as with the invite code), or a 4xx with the reason if WhatsApp refuses the lookup by id.

Requests - Responses

Both calls return HTTP 500:

13 INTERNAL: Internal server error: runtime error: invalid memory address or nil pointer dereference.

The decoded stack in the message points to github.com/devlikeapro/gows/server.toNewsletter. The session stays WORKING.

  • GET /api/default/channels/0029Va4K0PZ5a245NkngBA2M (invite code of the same channel): 200, correct data.
  • GET /api/default/channels/<id of a followed channel>@newsletter and its /messages/preview: 200.
Additional context

Likely cause, in gows-plus src/server/newsletter.go, GetNewsletterInfo: jid, err := types.ParseJID(id) inside the if block declares a new err, so the error returned by cli.GetNewsletterInfo(ctx, jid) is assigned to that inner variable. The outer err stays nil and toNewsletter(nil) dereferences a nil resp:

var resp *types.NewsletterMetadata
if gows.HasNewsletterSuffix(id) {
    jid, err := types.ParseJID(id) // shadows the outer err
    if err != nil {
        return nil, err
    }
    resp, err = cli.GetNewsletterInfo(ctx, jid) // error lost
} else {
    resp, err = cli.GetNewsletterInfoWithInvite(ctx, id)
}
if err != nil { // outer err, still nil
    return nil, err
}
return toNewsletter(resp), nil // resp == nil

Possible fix: declare var jid types.JID and assign with jid, err = types.ParseJID(id), and return an error when resp == nil. That would surface WhatsApp's actual refusal for unfollowed channels instead of a crash. Happy to open a PR on gows-plus if that helps.

Dominant language
TypeScript
Stars
7.6k
Forks
1.8k
Avg merge
4d 20h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from devlikeapro/waha

All issues in devlikeapro/waha

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.