Why am I receiving a 'storefront_not_found' message when using Hydrogen CLI?

Topic summary

A developer encountered a storefront_not_found error when running npx shopify hydrogen env pull. The error originated from the Admin GraphQL API, indicating the CLI couldn’t locate the associated storefront.

Root Cause:
The Hydrogen project was linked to an outdated/incorrect storefront instance from initial setup, even though the developer had proper environment variables and a working localhost setup.

Resolution:

  • Ran h2 link command to re-establish the storefront connection
  • The CLI prompted to unlink the old storefront instance
  • Selected the current/correct storefront
  • Warning disappeared and the issue was resolved

This demonstrates the importance of verifying storefront linkage when working with multiple Hydrogen environments or after initial project setup.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

I’m trying to execute:

npx shopify hydrogen env pull

But I’m getting:

The Admin GraphQL API responded unsuccessfully with errors:                                                                                                                                                                                                                                                                                                                                                                                   
│  [                                                                                                                                                                                                                         
│    {                                                                                                                                                                                                                       
│      "message": "storefront_not_found",                                                                                                                                                                                    
│      "locations": [                                                                                                                                                                                                        
│        {                                                                                                                                                                                                                   
│          "line": 3,                                                                                                                                                                                                        
│          "column": 5                                                                                                                                                                                                       
│        }                                                                                                                                                                                                                   
│      ],                                                                                                                                                                                                                    
│      "path": [                                                                                                                                                                                                             
│        "hydrogenStorefront"                                                                                                                                                                                                
│      ]                                                                                                                                                                                                                     
│    }                                                                                                                                                                                                                       
│  ]

When I do a ‘link’ it shows that I’m linked to the proper store.

I do have localhost working. Git is has code, and I have a deployment to a ‘dev’ site. I’m not sure where to declare that storefront value? I feel like I have proper .env on the storefront since the external dev site appears to be working.

The problem was that I had it linked to an older instance when I first started. I issued ..

h2 link

It asked if I wanted to unlink to the current (old) storefront, then I picked the current one. Warning is gone now.