{
  "id": "database/postgres-wal-archive-failure",
  "signature": "ERROR: archive command failed with exit code 1 DETAIL: The archive command was: cp %p /archive/%f",
  "signature_zh": "错误：归档命令失败，退出代码为1 详细信息：归档命令是：cp %p /archive/%f",
  "regex": "archive command failed with exit code \\d+",
  "domain": "database",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "PostgreSQL WAL archiving command fails due to insufficient disk space, permission issues, or incorrect archive destination path.",
  "root_cause_type": "generic",
  "root_cause_zh": "PostgreSQL WAL归档命令因磁盘空间不足、权限问题或归档目标路径不正确而失败。",
  "versions": [
    {
      "version": "PostgreSQL 14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase wal_keep_segments to a very high value to avoid archiving",
      "why_fails": "This only delays the problem; WAL segments still accumulate and eventually fill pg_wal, causing PostgreSQL to crash.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set archive_mode=off to disable archiving entirely",
      "why_fails": "Disabling archiving breaks point-in-time recovery and replication; not a viable fix for production systems that require backups.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.",
      "success_rate": 0.9,
      "how": "Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;",
      "success_rate": 0.85,
      "how": "Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.",
      "success_rate": 0.95,
      "how": "Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.",
    "Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;",
    "Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.postgresql.org/docs/16/continuous-archiving.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}