Try Serpent Free

How to fix INVALID_TYPE in Salesforce deployments

A metadata component, or a type it references, is not valid or enabled in the target org.

Surfaces during: metadata deploy validation, before any DML or test runs

What it means

INVALID_TYPE means the target org rejected a metadata component because its type, or a type it depends on, is not supported there. This usually traces back to an org feature or license that is not enabled in the target, an API version mismatch, or a standard object or field that does not exist in that org's edition.

It's most common when promoting metadata from a feature-rich production org, or a full sandbox copy of one, into a scratch org or Developer Edition sandbox whose feature set and licenses were never configured to match.

Diagnosis

Common causes

Feature not enabled in the target org
The metadata depends on a feature such as Person Accounts or Multi-Currency that is on in the source org but off in the target.
API version mismatch
The metadata's API version references a field or capability that the target org's supported API version does not recognize.
Standard object or field missing for the edition
The referenced standard object or field is only available on a Salesforce edition or license the target org does not have.

The fix

  1. Confirm the feature is enabled
    Check that the target org has the same feature or license, Person Accounts, Multi-Currency, or similar, turned on as the source.
  2. Align the API version
    Match the metadata's API version in package.xml to a version the target org fully supports.
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
      <types>
        <members>*</members>
        <name>CustomObject</name>
      </types>
      <version>62.0</version>
    </Package>
  3. Verify edition compatibility
    Confirm the target org's Salesforce edition includes the standard object or field the component depends on.
In practice

How Serpent prevents this

Serpent AI compares source and target org capabilities before scoping a task, so an edition or feature gap shows up as a warning instead of a failed deploy. See the Salesforce deployment error library.

Metadata and data in one deployment flow in Serpent

Prevention

Match scratch org feature definitions to production's enabled features
Keep scratch-org-def.json's features and edition settings in sync with what production actually has enabled, reviewed whenever a new feature is turned on.
Pin package.xml to a deliberate API version, not always-latest
Choose an API version your whole toolchain and every target org supports, and bump it deliberately rather than letting it drift to whatever your CLI defaults to.
Document edition-gated dependencies on the component itself
Note in the metadata's description or in schema docs when a component depends on a specific edition or license, so it's visible before a promotion attempt.
Common questions

INVALID_TYPE, answered

Does INVALID_TYPE mean the metadata XML is malformed?
No. The XML is usually valid; the type it declares or references just is not supported by the target org's edition, features, or API version.
Can I enable a missing feature myself, or does it require Salesforce support?
It depends on the feature. Some, like Multi-Currency, are self-service in Setup but effectively irreversible; others, like Person Accounts, require a Salesforce support case to enable.
Does downgrading the API version in package.xml ever cause new problems?
Yes, it can hide access to newer fields or metadata types your code actually needs. Match the version to what the target org supports rather than downgrading further than necessary.

Start free. No credit card, no install, no commitment.

Set up in under 15 minutes. No DevOps hire needed.

Curious about faster shipping before you dive in? Let's talk

Commitment free!