ITSolution4U - Er. Ashok Prajapati
MCA | Master of Science in Cyber Security
ITSolution4U Er. Ashok Prajapati +91 9824974641

🖨️ Printer Error 0x00000021 – The Process Cannot Access the File | Causes & Solutions - ITSolution4U

🖨️ 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?

DetailInformation
Error Code0x00000021
Decimal Code33
Error NameERROR_LOCK_VIOLATION
DescriptionThe process cannot access the file because another process has locked a portion of the file
Operating SystemWindows
Possible ScenarioPrint 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

  1. 🔒 Another process has locked a portion of a print-related file.

  2. 🖨️ Print Spooler is processing a print job.

  3. 🔄 A previous print job is stuck in the queue.

  4. 📁 Temporary print files are being accessed by another process.

  5. ⚙️ Printer driver or printing software conflicts.

  6. 🛡️ Antivirus or endpoint security software is scanning print files.

  7. 💻 Multiple applications are accessing the same printing resource.

  8. 🔧 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.

  1. Open Settings.

  2. Navigate to Bluetooth & devices → Printers & scanners.

  3. Select the affected printer.

  4. Click Open print queue.

  5. Select pending print jobs.

  6. Click Cancel.

Try printing a new document.

3. Restart the Print Spooler Service

Print Spooler manages print jobs and communication with printer drivers.

  1. Press Windows + R.

  2. Type:

services.msc
  1. Press Enter.

  2. Locate Print Spooler.

  3. Right-click and select Restart.

Alternatively, run Command Prompt as Administrator:

net stop spooler
net start spooler

4. Clear the Print Spooler Queue

If print jobs remain stuck, clear the spool folder carefully.

  1. Press Windows + R.

  2. Type services.msc.

  3. Stop the Print Spooler service.

  4. Open File Explorer.

  5. Navigate to:

C:\Windows\System32\spool\PRINTERS
  1. Delete pending spool files inside the folder.

  2. Return to Services.

  3. 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.

  1. Press Windows + X.

  2. Open Device Manager.

  3. Expand Print queues or Printers.

  4. Right-click the affected printer.

  5. Select Update driver.

  6. 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.

  1. Close all printing applications.

  2. Turn off the printer.

  3. Restart the computer.

  4. Turn on the printer.

  5. Try printing a test page.

8. Check Windows Event Viewer

Event Viewer can help identify related service or application errors.

  1. Press Windows + R.

  2. Type:

eventvwr.msc
  1. Press Enter.

  2. Open Windows Logs → System.

  3. Review errors and warnings around the time of the issue.

  4. 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 spooler

Stop Print Spooler:

net stop spooler

Start Print Spooler:

net start spooler

Restart Print Spooler using PowerShell:

Restart-Service -Name Spooler

Open the spool folder:

explorer C:\Windows\System32\spool\PRINTERS

Use 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 CodeError NameMeaning
0x00000020ERROR_SHARING_VIOLATIONAnother process is using the file
0x00000021ERROR_LOCK_VIOLATIONAnother 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:

🔹 💻 Computer Hardware
🔹 🪟 Windows Tips & Troubleshooting
🔹 🌐 Networking
🔹 🛡️ Cybersecurity
🔹 🔧 Computer Repair & IT Support
🔹 🖥️ Information Technology

📞 Contact: +91 9824974641
📱 Social Media: @ITSolution4U

👨‍💻 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