{
  "id": "aws/sqs-message-attributes-missing",
  "signature": "An error occurred (InvalidMessageContents) when calling the SendMessage operation: Message attributes are required but missing",
  "signature_zh": "调用SendMessage操作时发生错误（InvalidMessageContents）：消息属性是必需的但缺失",
  "regex": "InvalidMessageContents|Message attributes are required but missing",
  "domain": "aws",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The SQS queue is configured with a policy or a Lambda trigger that expects specific message attributes, but the sent message does not include them.",
  "root_cause_type": "generic",
  "root_cause_zh": "SQS队列配置了期望特定消息属性的策略或Lambda触发器，但发送的消息不包含这些属性。",
  "versions": [
    {
      "version": "SQS 2012-11-05",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AWS CLI 2.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Lambda 2023-08-01",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Recreate the SQS queue with default settings",
      "why_fails": "Recreating the queue does not change the requirement for message attributes; the Lambda trigger or policy still expects them.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Send an empty message body",
      "why_fails": "The error is about missing message attributes, not the body; an empty body does not resolve the attribute requirement.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the message retention period",
      "why_fails": "Retention period does not affect message contents or attribute validation.",
      "fail_rate": 0.98,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Include the required message attributes when sending the message. Use the AWS CLI:\naws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --message-body \"Hello\" --message-attributes \"{\\\"AttributeName\\\":{\\\"DataType\\\":\\\"String\\\",\\\"StringValue\\\":\\\"Value\\\"}}\"",
      "success_rate": 0.9,
      "how": "Include the required message attributes when sending the message. Use the AWS CLI:\naws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --message-body \"Hello\" --message-attributes \"{\\\"AttributeName\\\":{\\\"DataType\\\":\\\"String\\\",\\\"StringValue\\\":\\\"Value\\\"}}\"",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check the queue's policy or Lambda event source mapping to identify required attributes:\naws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attribute-names Policy\n# Review the policy for conditions on message attributes.",
      "success_rate": 0.8,
      "how": "Check the queue's policy or Lambda event source mapping to identify required attributes:\naws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attribute-names Policy\n# Review the policy for conditions on message attributes.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Modify the Lambda trigger or queue policy to make attributes optional, if feasible:\n# Example: remove the condition that requires 'AttributeName' from the policy\naws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attributes Policy='{\"Version\":\"2012-10-17\",\"Statement\":[]}'",
      "success_rate": 0.7,
      "how": "Modify the Lambda trigger or queue policy to make attributes optional, if feasible:\n# Example: remove the condition that requires 'AttributeName' from the policy\naws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attributes Policy='{\"Version\":\"2012-10-17\",\"Statement\":[]}'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "发送消息时包含必需的消息属性。使用AWS CLI：\naws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --message-body \"Hello\" --message-attributes \"{\\\"AttributeName\\\":{\\\"DataType\\\":\\\"String\\\",\\\"StringValue\\\":\\\"Value\\\"}}\"",
    "检查队列策略或Lambda事件源映射以识别必需的属性：\naws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attribute-names Policy\n# 审查策略中关于消息属性的条件。",
    "如果可行，修改Lambda触发器或队列策略使属性变为可选：\n# 示例：从策略中移除要求'AttributeName'的条件\naws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --attributes Policy='{\"Version\":\"2012-10-17\",\"Statement\":[]}'"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html",
  "official_doc_section": null,
  "error_code": "InvalidMessageContents",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2023-10-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}