{
  "id": "data/json-schema-uri-resolution-timeout",
  "signature": "JSON Schema validation fails with timeout when resolving remote $ref URIs",
  "signature_zh": "JSON Schema验证在解析远程$ref URI时超时失败",
  "regex": "(?:timeout|Connection refused|resolve.*\\$ref|remote.*schema.*unreachable)",
  "domain": "data",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "JSON Schema definitions that use external $ref URIs (e.g., https://json-schema.org/draft/2020-12/schema) cause validation to hang or timeout when the remote server is unreachable or slow, especially in offline or restricted network environments.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用外部$ref URI（例如https://json-schema.org/draft/2020-12/schema）的JSON Schema定义，在远程服务器不可达或响应缓慢时会导致验证挂起或超时，特别是在离线或受限网络环境中。",
  "versions": [
    {
      "version": "ajv 8.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "jsonschema 4.20.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python 3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Node.js 21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This only delays the failure; if the remote server is permanently unreachable, the validation will still fail after the increased timeout.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Most validators have the same behavior; the issue is the network dependency, not the library implementation.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Retries cannot fix a fundamentally unreachable remote resource; they only add latency and complexity.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Download the remote schema locally and use a local file reference: `curl -o draft-2020-12.json https://json-schema.org/draft/2020-12/schema; then use $ref: './draft-2020-12.json'`",
      "success_rate": 0.95,
      "how": "Download the remote schema locally and use a local file reference: `curl -o draft-2020-12.json https://json-schema.org/draft/2020-12/schema; then use $ref: './draft-2020-12.json'`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a schema resolver with caching: `from jsonschema import RefResolver; resolver = RefResolver.from_schema(schema, store={'https://json-schema.org/draft/2020-12/schema': cached_schema})`",
      "success_rate": 0.9,
      "how": "Use a schema resolver with caching: `from jsonschema import RefResolver; resolver = RefResolver.from_schema(schema, store={'https://json-schema.org/draft/2020-12/schema': cached_schema})`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set a short timeout for HTTP requests in the validator: `import urllib.request; urllib.request.urlopen(url, timeout=5)`",
      "success_rate": 0.85,
      "how": "Set a short timeout for HTTP requests in the validator: `import urllib.request; urllib.request.urlopen(url, timeout=5)`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Download the remote schema locally and use a local file reference: `curl -o draft-2020-12.json https://json-schema.org/draft/2020-12/schema; then use $ref: './draft-2020-12.json'`",
    "Use a schema resolver with caching: `from jsonschema import RefResolver; resolver = RefResolver.from_schema(schema, store={'https://json-schema.org/draft/2020-12/schema': cached_schema})`",
    "Set a short timeout for HTTP requests in the validator: `import urllib.request; urllib.request.urlopen(url, timeout=5)`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://json-schema.org/understanding-json-schema/structuring.html",
  "official_doc_section": null,
  "error_code": "ValidationError",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-03-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}