{
  "id": "python/sqlalchemy-invalid-database-url",
  "signature": "sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string 'postgresql://user:pass@localhost:5432/db'",
  "signature_zh": "sqlalchemy.exc.ArgumentError: 无法从字符串 'postgresql://user:pass@localhost:5432/db' 解析 rfc1738 URL",
  "regex": "sqlalchemy\\.exc\\.ArgumentError:\\ Could\\ not\\ parse\\ rfc1738\\ URL\\ from\\ string\\ 'postgresql://user:pass@localhost:5432/db'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The database URL is malformed, often due to special characters in the password not being URL-encoded.",
  "root_cause_type": "generic",
  "root_cause_zh": "数据库 URL 格式错误，通常是由于密码中的特殊字符未进行 URL 编码。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Removing special characters from the password",
      "why_fails": "This changes the credentials and may break authentication.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using single quotes around the URL",
      "why_fails": "The URL is still invalid; the issue is with encoding.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "URL-encode the password",
      "success_rate": 0.98,
      "how": "from urllib.parse import quote_plus\npassword = 'p@ssword!'\nencoded_password = quote_plus(password)\nurl = f'postgresql://user:{encoded_password}@localhost:5432/db'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a config file with properly escaped strings",
      "success_rate": 0.9,
      "how": "# In config file:\nDATABASE_URL=postgresql://user:p%40ssword%21@localhost:5432/db",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-04-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}