{
  "id": "nextjs/invalid-image-remote-patterns",
  "signature": "Error: Invalid remotePatterns configuration in next.config.js. The 'hostname' field is required for each pattern.",
  "signature_zh": "错误：next.config.js 中的 remotePatterns 配置无效。每个模式都需要 'hostname' 字段。",
  "regex": "Invalid remotePatterns configuration|'hostname' field is required",
  "domain": "nextjs",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The `images.remotePatterns` array in next.config.js contains an object without a `hostname` field, which is mandatory. Next.js requires each pattern to have at least a hostname to match remote image URLs.",
  "root_cause_type": "generic",
  "root_cause_zh": "next.config.js 中的 `images.remotePatterns` 数组包含一个没有 `hostname` 字段的对象，该字段是必需的。Next.js 要求每个模式至少有一个 hostname 来匹配远程图像 URL。",
  "versions": [
    {
      "version": "Next.js 13.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Next.js 14.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Next.js 14.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The hostname field is still required even if protocol is specified; Next.js will still throw the same error.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "While a wildcard hostname is allowed, it must still be explicitly provided as a string; omitting the hostname field entirely will still cause the error.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "An empty array will not match any remote images, causing a different error: 'Invalid src prop on next/image, hostname is not configured' for any remote image.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure each object in remotePatterns has at least a hostname field. Example: `images: { remotePatterns: [{ hostname: 'example.com' }, { hostname: 'cdn.example.com', protocol: 'https' }] }`.",
      "success_rate": 0.95,
      "how": "Ensure each object in remotePatterns has at least a hostname field. Example: `images: { remotePatterns: [{ hostname: 'example.com' }, { hostname: 'cdn.example.com', protocol: 'https' }] }`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If allowing all hosts, use a wildcard hostname: `images: { remotePatterns: [{ hostname: '**' }] }`. Note: this is insecure for production; use specific hostnames instead.",
      "success_rate": 0.9,
      "how": "If allowing all hosts, use a wildcard hostname: `images: { remotePatterns: [{ hostname: '**' }] }`. Note: this is insecure for production; use specific hostnames instead.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the deprecated `domains` array instead of remotePatterns for simple cases: `images: { domains: ['example.com'] }`. Note: domains is deprecated in Next.js 14 but still works.",
      "success_rate": 0.85,
      "how": "Use the deprecated `domains` array instead of remotePatterns for simple cases: `images: { domains: ['example.com'] }`. Note: domains is deprecated in Next.js 14 but still works.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "确保 remotePatterns 中的每个对象至少有一个 hostname 字段。示例：`images: { remotePatterns: [{ hostname: 'example.com' }, { hostname: 'cdn.example.com', protocol: 'https' }] }`。",
    "如果允许所有主机，使用通配符 hostname：`images: { remotePatterns: [{ hostname: '**' }] }`。注意：这在生产环境中不安全，请使用特定的 hostname。",
    "对于简单情况，使用已弃用的 `domains` 数组代替 remotePatterns：`images: { domains: ['example.com'] }`。注意：domains 在 Next.js 14 中已弃用，但仍然有效。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/api-reference/components/image#remotepatterns",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.93,
  "resolvable": "true",
  "first_seen": "2023-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}