Wednesday, December 3, 2025

Why Salesforce CLI Shows No Results Found and How to Fix It

When Your Salesforce Metadata Disappears: Understanding the "No Results Found" Paradox

Imagine this scenario: you're building momentum on a Salesforce project, confidently deploying changes across multiple custom objects. Then suddenly, for one specific object, the system goes silent. Your field changes vanish into a void. The CLI reports "No results found"—not an error, not a warning, just... nothing. This isn't a random glitch; it's a window into how Salesforce CLI interprets your source structure and what it considers deployable metadata.

The Real Problem Behind the Silence

What you're experiencing reveals a fundamental tension in how Salesforce's source-driven development model works. The "No results found" message isn't telling you that nothing exists—it's telling you that the CLI can't recognize your changes within its configured deployment scope.[1][2] This distinction matters enormously for your development workflow and your understanding of source tracking in Salesforce.

The issue typically stems from one of several interconnected factors:

Configuration Misalignment — Your sfdx-project.json file defines which directories the CLI monitors for changes. If a folder exists outside these configured packageDirectories, the CLI treats it as invisible, even if your metadata is perfectly valid.[1] This creates a scenario where your files are physically present but organizationally absent from the CLI's perspective.

Source Tracking Complications — Not all orgs have source tracking enabled, and certain metadata types remain incompatible with second-generation packaging.[1][4] When you're working with metadata that falls outside standard packaging support—like workflow email alerts using org-wide email addresses—you face a genuine architectural constraint that no amount of file reorganization can solve.

Experimental Deploy Settings — If you're using VS Code with Salesforce extensions, experimental deploy and retrieve features can interfere with standard source operations, causing the CLI to report "No results found" when it actually encounters configuration conflicts.[4][5]

Diagnosing Your Specific Situation

Before diving into solutions, verify these foundational elements:

Validate Your XML Structure — Even minor XML formatting issues can cause the CLI to skip your metadata silently. Use your IDE's XML validation tools and compare your working object's field XML directly against the non-working one, character by character.

Check Your .forceignore Configuration — This file acts as a gatekeeper for what the CLI considers deployable. Review whether patterns in your .forceignore might be excluding your specific object or field type unintentionally.[1]

Examine Your sfdx-project.json — Ensure that the parent directory containing your custom object is explicitly listed in packageDirectories. The CLI requires this configuration to recognize source changes.[1] However, be aware that adding non-packaged metadata to this file will include it in force:source:push and force:source:pull operations, potentially affecting your deployment pipelines.

Verify Source Tracking Status — Run diagnostic checks to confirm your org actually has source tracking enabled. Organizations without source tracking capabilities will consistently return "No results found" regardless of your configuration.[4]

Strategic Workarounds for Complex Scenarios

If you're maintaining "non-packaged metadata" that exists outside standard second-generation packaging constraints, consider these approaches:

Dedicated Deployment Folders — Create separate source directories specifically for metadata that won't be packaged. Use explicit force:source:deploy commands with the -p flag pointing to these directories, bypassing the standard push/pull workflow entirely.[1]

Experimental Deploy Toggle — If using VS Code, disable experimental deploy and retrieve features through your settings. Open your Command Palette, navigate to Preferences, and search for "Experimental Deploy" to turn it off.[5]

Update Your CLI Version — Earlier versions of Salesforce CLI (particularly around 7.85.1) had known issues with the force:source:deploy command returning "No results found" even for valid metadata.[2] Ensure you're running the latest stable version of the Salesforce CLI.

Use the Doctor Command — When troubleshooting persists, leverage Salesforce CLI's built-in diagnostic tool. The doctor command quickly gathers your configuration data and runs comprehensive tests to identify what's preventing recognition of your changes.[3]

The Bigger Picture: Rethinking Your Source Strategy

This challenge points to a larger consideration for your Salesforce development practice. The tension between what you want to deploy and what the CLI recognizes as deployable often signals that your source organization doesn't align with your actual business requirements. Rather than fighting the system, consider whether your metadata structure reflects your true deployment needs.

For organizations managing complex metadata landscapes with second-generation packaging limitations, the most sustainable approach involves explicitly separating packaged and non-packaged source, then using targeted deployment commands for each category. This transforms the "No results found" problem from a frustrating mystery into a predictable, manageable aspect of your CI/CD pipeline.

When dealing with similar configuration challenges in other platforms, tools like Make.com offer visual automation workflows that can help bridge deployment gaps, while Stacksync provides real-time database synchronization that eliminates many metadata tracking issues entirely.

The silence from your CLI isn't random—it's your system telling you something about how it's configured to listen. Understanding this distinction between what exists and what's recognized is crucial for building robust integration strategies that work with your tools rather than against them.

What does the Salesforce CLI message "No results found" actually mean?

It usually means the CLI cannot recognize any changes within its configured source scope — not that the files don't exist. The CLI only reports metadata it considers deployable based on your project configuration, .forceignore, source tracking status, and supported metadata types. When facing similar configuration challenges with other platforms, comprehensive platform guides can help you understand how different systems handle metadata and configuration files.

Why is my custom object or fields ignored even though the files exist in my repo?

Common causes are: the parent folder isn't listed in packageDirectories in sfdx-project.json, the files match patterns in .forceignore, or the metadata type isn't supported by your org's packaging/source-tracking configuration. Understanding proper configuration management across different platforms can help you avoid similar issues when working with complex metadata structures.

How do I check and fix my sfdx-project.json so the CLI sees my source?

Open sfdx-project.json and ensure the directory that contains your custom object is listed in packageDirectories. If you add non-packaged folders there, be aware they will be included in push/pull operations and may affect CI/CD behavior—consider using separate directories for non-packaged metadata instead. For teams managing complex deployment workflows, integration suite strategies can provide insights into organizing and deploying custom configurations effectively.

Could .forceignore be causing "No results found"?

Yes. .forceignore excludes files from deploy/push operations. Review patterns in that file to make sure you aren't unintentionally excluding the object or field XML. Temporarily removing or adjusting relevant patterns can help isolate the issue. When troubleshooting deployment issues across different platforms, cloud platform integration guides often contain similar troubleshooting patterns that can be adapted to your specific environment.

How can XML formatting cause the CLI to ignore metadata?

Minor XML errors (missing tags, stray characters, encoding issues) can make the CLI skip files silently. Validate the XML in your IDE and compare the problematic file against a working one character-by-character to find subtle differences. For developers working with multiple platforms that use XML configuration, test-driven development approaches can help establish validation patterns that catch these issues early in the development process.

What role does source tracking play and how do I know if my org has it enabled?

Source tracking lets the CLI detect local vs org changes for push/pull. Some org types and older org setups do not support it. Run diagnostic commands (or check org metadata/features) to confirm source-tracking status—if it's disabled, push/pull will not detect changes and can return "No results found." Organizations implementing Zoho Projects for development workflow management often find that proper source control integration becomes crucial for tracking changes across team environments.

Some metadata isn't compatible with second-generation packaging. What should I do?

For metadata types incompatible with 2GP (for example certain org-wide email workflows), separate them from packaged source and manage them with explicit deploy commands or dedicated non-packaged source directories rather than relying on package-based push/pull workflows. Teams managing complex deployment scenarios often benefit from customer success strategies that help establish clear deployment processes and communication protocols.

How do I deploy metadata that sits outside my package directories?

Put non-packaged metadata in dedicated folders and use explicit deploy commands like sfdx force:source:deploy -p path/to/folder. This bypasses push/pull and lets you target those files directly. For organizations using Zoho Flow for automation, similar principles apply when setting up deployment workflows that need to handle different types of configurations and metadata outside the standard package structure.

Could experimental deploy/retrieve features in VS Code be causing the issue?

Yes. VS Code's experimental deploy/retrieve can interfere with standard source behavior. Disable "Experimental Deploy" in the Salesforce extension settings (via the Command Palette → Preferences) and retry your operation. Development teams working with multiple tools often find that modern development productivity techniques help them manage tool conflicts and maintain consistent deployment processes across different environments.

Might my Salesforce CLI version be the cause?

Older CLI versions have had bugs where valid metadata returned "No results found." Update to the latest stable Salesforce CLI to ensure you aren't hitting a known issue. When managing development tools and keeping them updated, enterprise tool management guides can help establish processes for maintaining current versions and avoiding compatibility issues across your development stack.

What diagnostic tools can I run to find why the CLI won't recognize changes?

Use the CLI's built-in diagnostics (for example the doctor command) to gather configuration and run checks. Also inspect sfdx-project.json, .forceignore, XML validity, and source-tracking status as part of your troubleshooting. For comprehensive diagnostic approaches, Salesforce optimization guides provide systematic troubleshooting methodologies that can be applied to CLI issues and broader platform challenges.

How should I organize source long-term to avoid this problem?

Adopt a clear separation between packaged and non-packaged source: keep packaged metadata in packageDirectories and manage non-packaged metadata in dedicated folders deployed with targeted commands. Reflect this in your CI/CD pipelines so each category uses the appropriate deploy method. Organizations implementing Zoho CRM alongside Salesforce often find that establishing consistent organizational patterns across platforms helps teams maintain clarity and reduces configuration errors.

Will adding a folder to packageDirectories affect my push/pull workflow and pipelines?

Yes. Any directory listed in packageDirectories becomes part of push/pull operations. Adding non-packaged or environment-specific metadata there can change CI/CD behavior, so consider using separate directories and explicit deploy steps for non-standard metadata. Teams managing complex deployment workflows often benefit from SaaS internal controls frameworks that help establish clear governance around deployment processes and change management procedures.

No comments:

Post a Comment