{
  "id": "database/postgresql-wal-archiver-failed",
  "signature": "ERROR: archive command failed with exit code 1: cp pg_wal/000000010000000000000001 /archive/000000010000000000000001",
  "signature_zh": "错误：归档命令失败，退出代码 1：cp pg_wal/000000010000000000000001 /archive/000000010000000000000001",
  "regex": "ERROR: archive command failed with exit code \\d+: .*",
  "domain": "database",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The PostgreSQL archiver process fails to copy WAL segments to the archive destination, typically due to disk full, permission issues, or missing directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "PostgreSQL 归档进程无法将 WAL 段复制到归档目标，通常由于磁盘满、权限问题或缺少目录。",
  "versions": [
    {
      "version": "PostgreSQL 14.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 15.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 16.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Restarting PostgreSQL without fixing the archive destination",
      "why_fails": "Restarting does not resolve the underlying issue; the archiver will continue to fail on the next WAL segment.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting archive_mode to off to stop archiving",
      "why_fails": "Disabling archiving can lead to WAL accumulation and potential data loss in case of a disaster recovery scenario.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check disk space and permissions: df -h /archive; ls -ld /archive; then ensure the archive directory exists: mkdir -p /archive && chown postgres:postgres /archive",
      "success_rate": 0.8,
      "how": "Check disk space and permissions: df -h /archive; ls -ld /archive; then ensure the archive directory exists: mkdir -p /archive && chown postgres:postgres /archive",
      "condition": "",
      "sources": []
    },
    {
      "action": "Test the archive command manually: su - postgres -c 'cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/000000010000000000000001' and fix errors (e.g., SELinux context).",
      "success_rate": 0.85,
      "how": "Test the archive command manually: su - postgres -c 'cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/000000010000000000000001' and fix errors (e.g., SELinux context).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "检查磁盘空间和权限：df -h /archive; ls -ld /archive；然后确保归档目录存在：mkdir -p /archive && chown postgres:postgres /archive",
    "手动测试归档命令：su - postgres -c 'cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/000000010000000000000001' 并修复错误（例如 SELinux 上下文）。"
  ],
  "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.88,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}