# go: error obtaining build cache: open /root/.cache/go-build/log.txt: permission denied

- **ID:** `go/build-cache-invalid`
- **Domain:** go
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The build cache directory is owned by a different user or has incorrect permissions, preventing writing.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **Change ownership of the build cache directory to the current user.** (95% success)
   ```
   Run 'sudo chown -R $USER:$USER /root/.cache/go-build' (adjust path if needed).
   ```
2. **Set GOCACHE to a writable directory.** (90% success)
   ```
   Run 'export GOCACHE=$HOME/.cache/go-build' and ensure the directory exists: 'mkdir -p $GOCACHE'.
   ```

## Dead Ends

- **Running 'go clean -cache' to clear cache.** — The command fails because it cannot access the cache to remove it. (80% fail)
- **Setting GOCACHE to a different path without creating it.** — Go won't automatically create the directory; it must exist with proper permissions. (70% fail)
