hashicorp/packer · error

No active HCP Packer registry was found for the organization

Error message

No active HCP Packer registry was found for the organization %q and project %q

What it means

ValidateRegistryForProject calls PackerServiceGetRegistry for the resolved organization/project and throws this when the API succeeds but returns no Registry object — i.e. no active HCP Packer registry exists for that org/project combination. Called by loadProjectID when HCP_PROJECT_ID is set, and also before registry operations. It confirms credentials work but the target has no registry.

Source

Thrown at internal/hcp/api/client.go:203

		}
	}
	return oldestProj, nil
}

// ValidateRegistryForProject validates that there is an active registry associated to the configured organization and project ids.
// A successful validation will result in a nil response. All other response represent an invalid registry error request or a registry not found error.
func (c *Client) ValidateRegistryForProject() error {
	params := packerSvc.NewPackerServiceGetRegistryParams()
	params.LocationOrganizationID = c.OrganizationID
	params.LocationProjectID = c.ProjectID

	resp, err := c.Packer.PackerServiceGetRegistry(params, nil)
	if err != nil {
		return err
	}

	if resp.GetPayload().Registry == nil {
		return fmt.Errorf("No active HCP Packer registry was found for the organization %q and project %q", c.OrganizationID, c.ProjectID)
	}

	return nil

}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Create/activate an HCP Packer registry in the target project via the HCP console.
  2. Point HCP_PROJECT_ID (or the project config) at the project that actually hosts the registry.
  3. Verify registry status in the HCP console under Packer > Registry.

Example fix

// before
export HCP_PROJECT_ID="proj-without-registry"
// after
export HCP_PROJECT_ID="proj-with-active-registry" // or create a registry in proj-without-registry
Defensive patterns

Strategy: validation

Validate before calling

// confirm a registry exists before building with HCP metadata
if err := client.ValidateRegistryForProject(); err != nil {
    return fmt.Errorf("create an HCP Packer registry in project %s first: %w", projectID, err)
}

Try / catch

if err := client.ValidateRegistryForProject(); err != nil {
    if strings.Contains(err.Error(), "No active HCP Packer registry") {
        return fmt.Errorf("enable the HCP Packer registry for org=%s project=%s", orgID, projectID)
    }
    return err
}

Prevention

When it happens

Trigger: PackerServiceGetRegistry returns success with resp.GetPayload().Registry == nil for c.OrganizationID/c.ProjectID; happens in loadProjectID after reading HCP_PROJECT_ID, or on direct ValidateRegistryForProject calls.

Common situations: HCP Packer registry was never created (or was deactivated) in the target project; HCP_PROJECT_ID points at a project without a registry; registry deleted after being provisioned.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/f97d1829ad5281a5. Report an issue: GitHub.