# AssetDatabase.Refresh failed: Could not refresh asset 'Assets/Resources/data.asset' because the file is locked by another process.

- **ID:** `unity/assetdatabase-refresh-failed-locked-file`
- **Domain:** unity
- **Category:** io_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

A file in the project's Assets folder is locked by an external program (e.g., version control, text editor, or antivirus), preventing Unity from reading or writing it during refresh.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2020.3.0f1 | active | — | — |
| Unity 2021.3.0f1 | active | — | — |
| Unity 2022.3.0f1 | active | — | — |
| Unity 2023.2.0f1 | active | — | — |

## Workarounds

1. **Identify and close the locking process: Use tools like Sysinternals Handle.exe to find which process has a lock on the file. In Command Prompt: handle.exe -a "Assets/Resources/data.asset" then close the identified application (e.g., Notepad++ or Git).** (85% success)
   ```
   Identify and close the locking process: Use tools like Sysinternals Handle.exe to find which process has a lock on the file. In Command Prompt: handle.exe -a "Assets/Resources/data.asset" then close the identified application (e.g., Notepad++ or Git).
   ```
2. **Exclude the Unity project folder from antivirus real-time scanning to prevent locks. Then restart Unity and perform a refresh.** (80% success)
   ```
   Exclude the Unity project folder from antivirus real-time scanning to prevent locks. Then restart Unity and perform a refresh.
   ```

## Dead Ends

- **Run Unity as administrator** — Administrator privileges do not unlock files held by other processes; the lock persists. (80% fail)
- **Delete the locked file and recreate it** — Deleting may succeed but the new file can be locked again if the external process is still running. (70% fail)
