🖨️ Printer Error 0x00000021 – The Process Cannot Access the File | Causes & Solutions
🔍 Introduction
Are you facing Printer Error 0x00000021 while printing documents, installing a printer, or accessing shared printer resources in Windows?
This error indicates that Windows cannot access a particular portion of a file because another process has locked it.
During printing operations, this may involve print spool files, temporary printing resources, printer drivers, or files accessed by multiple applications.
In this article, we will understand the meaning of error 0x00000021, its possible causes, and practical troubleshooting methods.
⚠️ What Does Error 0x00000021 Mean?
| Detail | Information |
|---|---|
| Error Code | 0x00000021 |
| Decimal Code | 33 |
| Error Name | ERROR_LOCK_VIOLATION |
| Description | The process cannot access the file because another process has locked a portion of the file |
| Operating System | Windows |
| Possible Scenario | Print file or spool resource access |
Important: This is a general Windows file-locking error, not an error exclusive to printers. The code alone does not identify which application or process has locked the file.
🔎 Common Causes of Printer Error 0x00000021
🔒 Another process has locked a portion of a print-related file.
🖨️ Print Spooler is processing a print job.
🔄 A previous print job is stuck in the queue.
📁 Temporary print files are being accessed by another process.
⚙️ Printer driver or printing software conflicts.
🛡️ Antivirus or endpoint security software is scanning print files.
💻 Multiple applications are accessing the same printing resource.
🔧 File-system or application-level locking issues.
🛠️ How to Fix Printer Error 0x00000021
Follow these troubleshooting steps in sequence.
1. Close All Printing Applications
First, close applications that may be accessing the printer or print-related files.
Examples:
Microsoft Word
Microsoft Excel
Adobe Acrobat Reader
Web browsers
Printer management applications
Wait a few seconds and try printing again.
2. Cancel Pending Print Jobs
A stuck print job may contribute to printing problems.
Open Settings.
Navigate to Bluetooth & devices → Printers & scanners.
Select the affected printer.
Click Open print queue.
Select pending print jobs.
Click Cancel.
Try printing a new document.
3. Restart the Print Spooler Service
Print Spooler manages print jobs and communication with printer drivers.
Press
Windows + R.Type:
services.mscPress Enter.
Locate Print Spooler.
Right-click and select Restart.
Alternatively, run Command Prompt as Administrator:
net stop spoolernet start spooler
4. Clear the Print Spooler Queue
If print jobs remain stuck, clear the spool folder carefully.
Press
Windows + R.Type
services.msc.Stop the Print Spooler service.
Open File Explorer.
Navigate to:
C:\Windows\System32\spool\PRINTERSDelete pending spool files inside the folder.
Return to Services.
Start Print Spooler again.
Warning: This process deletes pending print jobs. If files remain locked, do not force-delete them. Investigate the process holding the files.
5. Check Printer Driver Issues
An outdated or incompatible printer driver may contribute to printing problems.
Press
Windows + X.Open Device Manager.
Expand Print queues or Printers.
Right-click the affected printer.
Select Update driver.
Install a compatible driver from the manufacturer's official website.
If required, reinstall the printer using the manufacturer's recommended procedure.
6. Check Antivirus and Endpoint Security
Security software may scan or temporarily access files used during printing.
Recommended checks:
Review antivirus logs.
Check security alerts.
Verify whether printer-related files were quarantined.
Review blocked application activity.
Consult the security administrator before creating exclusions.
Security Note: Do not permanently disable antivirus or endpoint protection to resolve this issue.
7. Restart the Computer and Printer
Temporary file locks may be released after restarting the applications and services using those files.
Close all printing applications.
Turn off the printer.
Restart the computer.
Turn on the printer.
Try printing a test page.
8. Check Windows Event Viewer
Event Viewer can help identify related service or application errors.
Press
Windows + R.Type:
eventvwr.mscPress Enter.
Open Windows Logs → System.
Review errors and warnings around the time of the issue.
Also check:
Applications and Services Logs → Microsoft → Windows → PrintService
Look for printer driver, Print Spooler, file-access, or application-related errors.
💻 Useful Windows Troubleshooting Commands
Check Print Spooler status:
sc query spoolerStop Print Spooler:
net stop spoolerStart Print Spooler:
net start spoolerRestart Print Spooler using PowerShell:
Restart-Service -Name SpoolerOpen the spool folder:
explorer C:\Windows\System32\spool\PRINTERSUse administrative privileges where required.
🔍 Difference Between Error 0x00000020 and 0x00000021
These two Windows errors are related to file-access conflicts but have different meanings.
| Error Code | Error Name | Meaning |
|---|---|---|
| 0x00000020 | ERROR_SHARING_VIOLATION | Another process is using the file |
| 0x00000021 | ERROR_LOCK_VIOLATION | Another process has locked a portion of the file |
Understanding this distinction helps IT administrators investigate the correct file-access problem.
🏢 Best Practices for Office and Corporate Networks
To reduce recurring printer file-access problems:
Monitor Print Spooler service health.
Remove unnecessary pending print jobs.
Maintain updated printer drivers.
Avoid duplicate or incompatible drivers.
Keep Windows systems updated.
Review endpoint security alerts.
Maintain appropriate printer permissions.
Document recurring printer problems.
Use centralized printer management where appropriate.
For printers supporting GxP-related activities, assess their intended use and impact on regulated processes. Follow applicable change-control and documentation procedures.
❓ Frequently Asked Questions (FAQs)
Q1. What is Windows error 0x00000021?
It is ERROR_LOCK_VIOLATION, meaning another process has locked a portion of the file that Windows is trying to access.
Q2. Can error 0x00000021 occur during printing?
Yes. It may occur when a printing operation encounters a locked print-related file or resource.
Q3. Is error 0x00000021 the same as 0x00000020?
No. Error 0x00000020 is a sharing violation, whereas 0x00000021 is a lock violation.
Q4. Can restarting Print Spooler fix this error?
It may help if the issue involves a temporary print-related lock, but it is not a guaranteed solution.
Q5. Can antivirus software cause file-locking problems?
Security software may temporarily access files during scanning. Check its logs before changing security settings.
Q6. Should I delete files from the Print Spooler folder?
Only when necessary, after stopping the Print Spooler service. Remember that deleting spool files removes pending print jobs.
🎯 Conclusion
Printer Error 0x00000021 – ERROR_LOCK_VIOLATION occurs when Windows cannot access a portion of a file because another process has locked it.
When this error appears during printing, check pending print jobs, Print Spooler, printer drivers, and possible file-access conflicts.
Always identify the underlying locking process before making changes to Windows services or security settings.
🌍 About ITSolution4U
ITSolution4U — Learn | Solve | Grow
💻 Explore practical tutorials covering:
👨💻 By Er. Ashok Prajapati
📢 Follow ITSolution4U for IT tutorials, cybersecurity awareness, data protection guides, networking tips, and technology updates.
#PrinterError #Error0x00000021 #ERRORLOCKVIOLATION #WindowsPrinterError #PrinterTroubleshooting #PrintSpooler #PrintQueue #PrinterDriver #FileLocking #Windows11 #Windows10 #ITSupport #Networking #ITSolution4U #AshokPrajapatiHacker