{
  "id": "data/json-schema-format-email-validation-failure",
  "signature": "JSON Schema validation fails: format 'email' rejects valid emails with plus signs or international characters",
  "signature_zh": "JSON Schema验证失败：格式'email'拒绝带有加号或国际字符的有效电子邮件",
  "regex": "format.*email.*rejected|does not match.*email format|ValidationError.*'email'",
  "domain": "data",
  "category": "validation_error",
  "subcategory": null,
  "root_cause": "JSON Schema's built-in 'email' format validation uses a regex that does not support modern email features (e.g., plus addressing, internationalized domain names), causing false negatives.",
  "root_cause_type": "generic",
  "root_cause_zh": "JSON Schema内置的'email'格式验证使用不支持现代电子邮件功能（如加号地址、国际化域名）的正则表达式，导致误报。",
  "versions": [
    {
      "version": "JSON Schema Draft-07",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Ajv 8.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python jsonschema 4.20.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OpenAPI 3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Writing a custom regex that correctly validates all valid email addresses is extremely complex and often introduces new bugs (e.g., rejecting valid addresses or allowing invalid ones).",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This disables all email validation, allowing any string to pass, which defeats the purpose of schema validation and may lead to downstream errors.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Not all validators support 'idn-email', and it still may reject plus signs or other common email features.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a custom format validator that follows RFC 5321/5322. In Python with jsonschema, register a custom validator: `import re; email_regex = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'; jsonschema.validators.create(meta_schema=..., validators={'format': lambda v, f, s: ...})`",
      "success_rate": 0.9,
      "how": "Use a custom format validator that follows RFC 5321/5322. In Python with jsonschema, register a custom validator: `import re; email_regex = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'; jsonschema.validators.create(meta_schema=..., validators={'format': lambda v, f, s: ...})`",
      "condition": "",
      "sources": []
    },
    {
      "action": "In Ajv (JavaScript), use `ajv.addFormat('email', /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)` to override the default email format with a more permissive regex",
      "success_rate": 0.85,
      "how": "In Ajv (JavaScript), use `ajv.addFormat('email', /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)` to override the default email format with a more permissive regex",
      "condition": "",
      "sources": []
    },
    {
      "action": "Switch to a validation library that supports RFC-compliant email validation, such as 'email-validator' in Python, and apply it as a custom keyword in the schema",
      "success_rate": 0.9,
      "how": "Switch to a validation library that supports RFC-compliant email validation, such as 'email-validator' in Python, and apply it as a custom keyword in the schema",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use a custom format validator that follows RFC 5321/5322. In Python with jsonschema, register a custom validator: `import re; email_regex = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'; jsonschema.validators.create(meta_schema=..., validators={'format': lambda v, f, s: ...})`",
    "In Ajv (JavaScript), use `ajv.addFormat('email', /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)` to override the default email format with a more permissive regex",
    "Switch to a validation library that supports RFC-compliant email validation, such as 'email-validator' in Python, and apply it as a custom keyword in the schema"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://json-schema.org/understanding-json-schema/reference/string.html#format",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-01-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}