Sage Error: A Managed Exception was Caught in caddattachementview::buildattachment

Sage Error Managed Exception was Caught in caddattachementview

When you’re debugging a codebase, it can be difficult to find and fix errors. This is especially true when you’re working with a codebase that’s been modified over time. When add attachment view build attachment is invoked, it creates an attachment in the given directory using the given file name. In this blog post, we will discuss how to debug errors in a codebase that’s been modified over time. We will also cover some tips for improving your workflow so that you can catch and fix errors more easily

Sage software remains to rule the ‘charts’ when it comes to offering some of the most well-sought Accounts and Finance related issues. The various features of the software are well-suited for both small-scale and large-scale businesses. Hence, it is because of its ease of use that Sage has been highly recommended across the globe. One can easily take charge of their everyday accounting requirements like Invoicing, Cashflow Management, Inventory Management, VAT returns, and others.

The best part about the Sage software is that this is a perfect go-to solution even for people without any Accounting background. Thus, now you can easily access the software and ensure that all your ‘book-keeping’ needs are catered to.

Error in Sage

Occurrence of Error and its subsequent handling is a relatively easy task. One has to be well-equipped with a few basics and all the solutions are well-sorted accordingly. The Error: “a managed exception was caught in caddattachementview::buildattachment is one such issue. Let us take a look at some of the prime reasons and their solutions

Reason for Sage Error: “A Managed Exception was caught in caddattachementview::buildattachment

The main reason for the Error: “a managed exception was caught in caddattachementview::buildattachment  is usually the damaged files in the Company directory.

Now, let us go ahead and check out the top Solutions:

Read Also-: How to Resolve Sage 50 General.dat Error

Step to Fix Sage Error: “A Managed Exception was Caught in caddattachementview::buildattachment

Solution 1: To do so you will need to:

  • Go to the specific company location 
  • Check out for the file types DDF within the deirectory
  • Now, rename the following:
    • Userpref.dat to OldUserpref.dat
    • Attchmnt.dat to OldAttchmnt.dat
    • Atmntbdl.dat to OldAtmntbdl.dat
    • Audittr.dat to OldAudittr.dat
    • Go aheaad and delete all the files with .DDF extension 
    • Similarly delete all the files with .LCK file type or extension
    • Delete the files with .PTL file type or extension
  • Bear in mind that the attachment feature within the file is in use, in this case the renaming of the Attchmnt.dat and Atmntbdl.dat will cause the break in the links of the attached files. 
  • Now, click on Windows Key + R
  • Enter in Services.msc
  • Click on OK
  • Go to Pervasive PSQL Workgroup Engine/ Actian PSQL Workgroup Engine and right click on it.
  • Click on Restart
  • Close the Services
  • Now, open up Sage 50
  • Check if you can open the Windows once again without the error. In case the error persists, go ahead to the next step
  • Once again start from steps 1-3
  • Now, delete the following files:
    • File type MKD
    • File type DATtemp
    • File with name company_[Number].db
    • Be sure not to delete the file type company.db
  • Now, check once again if you can open the Windows 
  • You should be done by now

How to Delete Expandable DAT Files from the Clear Data Folder

If you need to know on how to delete the expandable DAT files, you need to follow the below steps:

  • Go to the Clean data folder 
  • Now delete the following files within





              ATMNTBDL.DAT (attachments will be lost)

                   ATTCHMNT.DAT(attachments will be lost)






                   RPTDATA.DAT(custom reports will be lost)


                 ATTACHMENTS folder (attachments will be lost)

             All temporary files (search for *temp)

            All “old” files (search for old* and *.old)

             All .MKD files (search for *.MKD)

         All .PTR files (search for *.PTR)

           All .RPT files (search for *.RPT) 
  • Now open the New company Folder
  • Hit on Yes for all the prompts you receive to create the empty files
  • Check for errors. Probably you will not receive any.

Important Tip

Before you try to implement the above solution, it is recommended that you always create the required backup of all your important files. It is also to be noted that on implementing the above solutions, there can be a subsequent loss of non-critical data in the program. These includes existing attachments, Track-it issues, and also alerts.

How to Locate Company Directories

In order to be able to determine the location of the companies in the hard drives, you need to first be able to determine if the right version of your company has been found. Also ensure that no changes to the company has been made until the proper version has been determined.

Solution 1: Directory within an Open Company

  • Go to maintain
  • Go to Company information
  • Locate Directory line 
  • It is in the directory line that the location of the open company is found

Solution 2: Remote Data Access Company

  • Go to the System on the left-side
  • Go to the section with company maintaninence
  • It is here that the company directory is located.

Solution 3: From the Open Existing Company Option

  • Go to the Files
  • Click open company
  • Go to the main sage window where no companies are open
  • Click on open an exsiting company note
  • This will display all the opened companies history 
  • The location of every company will be given in the directory column

Solution 4: Using the Windows Search

For windows 10

  • Click open the File Explorer
  • Click the Search field
  • Click to select all the folders and the files
  • Type enter COMPANY.DAT
  • Ensure that the View is set to detail. 
  • Every search result with location can be found in the Folder column.

Also Read-: How to Fix PERMISS.DAT Error in Sage 50


So, there you have it people. These are the prime solutions when you encounter the Error: “a managed exception was caught in caddattachementview::buildattachment. However, there are a few more steps that you need to deal with before you implement the solutions. These includes locating the company directories and also creating the much required backup of all the important files and folders to ensure no loss of data occurs. If you required technical support just dial 1800 964 3096

Accounting Professionals & Specialized Experts

Want quick help from accounting software experts? Get in touch with our team members who can install, configure and configure your software for you. Proficient in fixing technical issues, they can help you quickly get back to work whenever you encounter an error in Sage software. Our team is available 24/7 365 days to assist you. To get in touch.

💠Frequently Asked Questions💠

What is the main cause for the Error: “a managed exception was caught in caddattachementview::buildattachment?

The main cause for the occurrence for this error type is the existence of the corrupt files in the company directory.

What are the Precautions one Needs to bear in Mind before the solutions for the Error are implemented?

One of the most important precaution is to make sure that the right backups for all the important data, files and folders are created. Likewise, ensure that the directory pathways for the Company files have been recognised and located.

Related Posts

Further Reading