Skip to content

ZodError when parsing GET_CHANNEL with messages in voice channel #349

Description

@abizareyhan

Summary

When using the Discord Embedded App SDK, calling GET_CHANNEL on a voice channel that contains at least one message results in a Zod parsing error, while channels with no messages work fine.

Steps to Reproduce

  1. Create a voice channel and send at least one message in it.
  2. Use the Embedded App SDK to call GET_CHANNEL for that channel.
  3. Observe the parsing error only when messages are present.

Example Data:

{
    "cmd": "GET_CHANNEL",
    "data": {
        "id": "REDACTED",
        "name": "test-voice",
        "type": 2,
        "topic": "",
        "bitrate": 64000,
        "user_limit": 0,
        "guild_id": "REDACTED",
        "position": 3,
        "messages": [
            {
                "id": "REDACTED",
                "blocked": false,
                "bot": false,
                "content": "test message",
                "content_parsed": [
                    {
                        "type": "text",
                        "content": "test message",
                        "originalMatch": {
                            "0": "test message",
                            "index": 0
                        }
                    }
                ],
                "nick": "AbizaReyhan",
                "author_color": "#4dcc44",
                "edited_timestamp": null,
                "timestamp": "2025-10-20T07:16:40.668Z",
                "tts": false,
                "mentions": [],
                "mention_everyone": false,
                "mention_roles": [],
                "embeds": [],
                "attachments": [],
                "author": {
                    "id": "REDACTED",
                    "username": "abizareyhan",
                    "discriminator": "0",
                    "global_name": "AbizaReyhan",
                    "avatar": "58fd83732b35810d7f84195c4caef00c",
                    "avatar_decoration_data": {
                        "asset": "a_9532e6bc08133eb1401c654a4f1a800e",
                        "skuId": "1332505467980873728"
                    },
                    "bot": false,
                    "flags": 48,
                    "premium_type": 0
                },
                "pinned": false,
                "type": 0
            }
        ],
        "voice_states": [
            {
                "nick": "AbizaReyhan",
                "mute": false,
                "volume": 199.52622985839844,
                "pan": {
                    "left": 1,
                    "right": 1
                },
                "voice_state": {
                    "mute": false,
                    "deaf": false,
                    "self_mute": true,
                    "self_deaf": true,
                    "suppress": false
                },
                "user": {
                    "id": "REDACTED",
                    "username": "abizareyhan",
                    "discriminator": "0",
                    "global_name": "AbizaReyhan",
                    "avatar": "58fd83732b35810d7f84195c4caef00c",
                    "avatar_decoration_data": {
                        "asset": "a_9532e6bc08133eb1401c654a4f1a800e",
                        "skuId": "1332505467980873728"
                    },
                    "bot": false,
                    "flags": 48,
                    "premium_type": 0
                }
            }
        ]
    },
    "evt": null,
    "nonce": "2295a751-d117-44ea-b8b6-e824d446528b"
}

Error Output

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "messages",
      0,
      "channel_id"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "date",
    "path": [
      "messages",
      0,
      "timestamp"
    ],
    "message": "Expected string, received date"
  },
  {
    "code": "invalid_type",
    "expected": "array",
    "received": "undefined",
    "path": [
      "messages",
      0,
      "mention_channels"
    ],
    "message": "Required"
  }
]
    at get error (@discord_embedded-app-sdk.js?v=c5854d92:685:23)
    at _ZodObject.parse (@discord_embedded-app-sdk.js?v=c5854d92:789:18)
    at parseResponseData (@discord_embedded-app-sdk.js?v=c5854d92:6807:33)
    at parseResponsePayload (@discord_embedded-app-sdk.js?v=c5854d92:6869:60)
    at parseIncomingPayload (@discord_embedded-app-sdk.js?v=c5854d92:6901:12)
    at DiscordSDK.handleFrame (@discord_embedded-app-sdk.js?v=c5854d92:7394:16)
    at DiscordSDK.handleMessage (@discord_embedded-app-sdk.js?v=c5854d92:7253:23)

Expected Behavior

  • The SDK should parse channel data regardless of whether messages are present.

Actual Behavior

  • ZodError occurs if the messages array has at least one message.
  • No error if the messages array is empty.

Screenshot of the message on voice channel

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions