{
  "id": "python/pytest-tmpdir-permission-denied",
  "signature": "PermissionError: [Errno 13] Permission denied: '/tmp/pytest-of-user/pytest-123/test_0/'",
  "signature_zh": "PermissionError: [Errno 13] 权限被拒绝: '/tmp/pytest-of-user/pytest-123/test_0/'",
  "regex": "PermissionError:\\ \\[Errno\\ 13\\]\\ Permission\\ denied:\\ '/tmp/pytest\\-of\\-user/pytest\\-123/test_0/'",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "The pytest tmpdir fixture cannot create or access a temporary directory due to insufficient permissions, often in restricted environments like containers.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest 的 tmpdir fixture 无法创建或访问临时目录，因为权限不足，通常发生在容器等受限环境中。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This is a security risk and may not be allowed in containerized environments; also, the issue might be with specific subdirectories.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Running tests as root is dangerous and can mask permission issues that would occur in production.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Set a custom temp directory with write permissions: `pytest --basetemp=/home/user/tmp`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use the `tmp_path` fixture instead of `tmpdir` (returns pathlib.Path) and ensure the parent directory is writable.",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-02-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}