---
schema_version: "1"
id: 0bd377ca014d0c83993455f80f1e6f1a80fd65db7d7c9305181df2bfce2068b0
title: Error Handling
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_error_handling.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_error_handling.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 25e771c1066af06753a0886f3ef56b0d47d3a2a5b7038ba3669b22d78a19c9be
description: Metadata API calls return error information that your client application can use to identify and resolve runtime errors.
---
# Error Handling

Metadata API calls return error information that your client application can use to identify and resolve runtime errors.

Metadata API provides these types of error handling.

- Since the Metadata API uses the enterprise or partner WSDLs to authenticate, it uses SOAP fault messages defined in those WSDLs for errors resulting from badly formed messages, failed authentication, or similar problems. Each SOAP fault has an associated ExceptionCode. For more details, see [Error Handling](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_concepts_errorhandling.htm) in the SOAP API Developer Guide.
- For errors with the asynchronous create(), update(), and delete() calls, see the error status code in the statusCode field in the [AsyncResult](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_asyncresult.htm "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") object for the associated component.
- For errors with the synchronous CRUD calls, see the error status code in the statusCode field of the [Error](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_error.htm "Represents an error that occurred during a synchronous CRUD (createMetadata(), updateMetadata(), or deleteMetadata()) operation.") object corresponding to each error in the array returned by the errors field of the appropriate result object. For example, the result object of [createMetadata()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_createMetadata.htm "Adds one or more new metadata components to your organization synchronously.") is [SaveResult](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_saveResult.htm "Contains result information for the createMetadata, updateMetadata, or renameMetadata call.").
- For errors with [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org."), see the problem and success fields in the [DeployMessage](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deployresult.htm#deploymessage) object for the associated component.
- For errors with [retrieve()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm "The retrieve() call retrieves XML file representations of components in an organization."), see the problem field in the [RetrieveMessage](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieveresult.htm#meta_retrieveresult_retrievemessage) object for the associated component.

For sample code, see [Step 3: Walk Through the Java Sample Code](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_quickstart_java_sample.htm#meta_quickstart_java_sample).