You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Discord Webhook请求400错误排查求助

解决Discord Webhook 400错误(embeds字段异常)

尝试发送Discord Webhook请求时触发400错误,报错信息为:

Webhook Sent 400 {"embeds": ["0"]}

首次请求可正常发送,但移除字段名称中的大括号后出现该问题,相关JSON代码如下:

{
    "content": "<@&1007047660735303700> <@&1142624156022747246>",
    "embeds": [
        {
            "title": "Bail Responses",
            "fields": [
                {
                    "name": "**Arresting Officer's Full name**",
                    "value": "{{Arresting Officer's Full name}}"
                },
                {
                    "name": "**Arresting Officer's Email (Discord) Name**",
                    "value": "{{Arresting Officer's Email (Discord) Name}}"
                },
                {
                    "name": "**Defendant's Full name**",
                    "value": "{{Defendant's Full name}}"
                },
                {
                    "name": "**Defendants Email (Discord) Name**",
                    "value": "{{Defendants Email (Discord) Name}}"
                },
                {
                    "name": "**Defendant's Charges**",
                    "value": "{{Defendant's Charges}}"
                },
                {
                    "name": "**What is the report number?**",
                    "value": "{{What is the report number?}}"
                },
                {
                    "name": "**Does the Subject need public counsel?**",
                    "value": "{{Does the Subject need public councel?}}"
                },
                {
                    "name": "**Is the Subject jailed until trial?**",
                    "value": "{{Is the Subject jailed until trial?}}"
                },
                {
                    "name": "**Does the Subject want to Post Bond?**",
                    "value": "{{Does the Subject want to Post Bond?}}"
                },
                {
                    "name": "**If you fail to attend court on your scheduled date and no contact is made with your lawyer within 48 hours after the scheduled date the following will occur: - A warrant will be issued for Failure to Appear - Your Bail will be forfeited - You will not be eligible to go out on bail for the next 30 days. If you DO show up for your court date you may be eligible to receive a portion of your bond back minus 10% for DOJ Court Costs.**",
                    "value": "{{If you fail to attend court on your scheduled date and no contact is made with your lawyer within 48 hours after the scheduled date the following will occur: - A warrant will be issued for Failure to Appear - Your Bail will be forfeited - You will not be eligible to go out on bail for the next 30 days. If you DO show up for your court date you may be eligible to receive a portion of your bond back minus 10% for DOJ Court Costs.}}"
                },
                {
                    "name": "**What was the Total Amount Invoiced? (should be 2 times the fine)**",
                    "value": "{{What was the Total Amount Invoiced? (should be 2 times the fine)}}"
                }
            ]
        }
    ]
}

错误原因与修复方案

  • 模板变量拼写错误:其中一个字段的value是{{Does the Subject need public councel?}},对应的name里是**Does the Subject need public counsel?**——counsel被误写成councel,导致模板引擎无法匹配变量,替换失败后生成无效内容,触发Discord格式校验。直接修正拼写,让变量名和字段名一致即可。
  • 未完成的变量替换:移除字段名称的大括号后,模板引擎的匹配逻辑可能被干扰,导致value中的{{...}}没有被正确替换成实际内容。发送前必须确认最终生成的JSON中,所有模板变量都已替换为非空有效内容,不能残留模板语法。
  • 字段长度超限风险:最后一个字段的name和value长度接近Discord限制(单字段name最多256字符,value最多1024字符),建议拆分长文本或简化内容,避免触发长度校验失败。
  • 分步排查定位:先发送仅含简单标题和单个字段的最小化embed,确认能正常发送后,再逐步添加其他字段,快速定位问题字段。

内容的提问来源于stack exchange,提问作者AJ Distaffen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 01:31:03