{"record":{"id":"f97d1829ad5281a5","repo":"hashicorp/packer","slug":"no-active-hcp-packer-registry-was-found-for-the-or","errorCode":null,"errorMessage":"No active HCP Packer registry was found for the organization %q and project %q","messagePattern":"No active HCP Packer registry was found for the organization %q and project %q","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hcp/api/client.go","lineNumber":203,"sourceCode":"\t\t}\n\t}\n\treturn oldestProj, nil\n}\n\n// ValidateRegistryForProject validates that there is an active registry associated to the configured organization and project ids.\n// A successful validation will result in a nil response. All other response represent an invalid registry error request or a registry not found error.\nfunc (c *Client) ValidateRegistryForProject() error {\n\tparams := packerSvc.NewPackerServiceGetRegistryParams()\n\tparams.LocationOrganizationID = c.OrganizationID\n\tparams.LocationProjectID = c.ProjectID\n\n\tresp, err := c.Packer.PackerServiceGetRegistry(params, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.GetPayload().Registry == nil {\n\t\treturn fmt.Errorf(\"No active HCP Packer registry was found for the organization %q and project %q\", c.OrganizationID, c.ProjectID)\n\t}\n\n\treturn nil\n\n}\n","sourceCodeStart":185,"sourceCodeEnd":209,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/api/client.go#L185-L209","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create/activate an HCP Packer registry in the target project via the HCP console.","Point HCP_PROJECT_ID (or the project config) at the project that actually hosts the registry.","Verify registry status in the HCP console under Packer > Registry."],"exampleFix":"// before\nexport HCP_PROJECT_ID=\"proj-without-registry\"\n// after\nexport HCP_PROJECT_ID=\"proj-with-active-registry\" // or create a registry in proj-without-registry","handlingStrategy":"validation","validationCode":"// confirm a registry exists before building with HCP metadata\nif err := client.ValidateRegistryForProject(); err != nil {\n    return fmt.Errorf(\"create an HCP Packer registry in project %s first: %w\", projectID, err)\n}","typeGuard":null,"tryCatchPattern":"if err := client.ValidateRegistryForProject(); err != nil {\n    if strings.Contains(err.Error(), \"No active HCP Packer registry\") {\n        return fmt.Errorf(\"enable the HCP Packer registry for org=%s project=%s\", orgID, projectID)\n    }\n    return err\n}","preventionTips":["Create the HCP Packer registry once per project in the HCP console before first use.","Verify HCP_PROJECT_ID points at the project hosting the registry.","Check registry status after org/project changes or deletions."],"tags":["hcp","packer-registry","configuration"],"backgroundTag":"hcp-registry-not-found","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}