# I am in a dilenma with this error--Failed to query available provider packages

**URL:** <https://discuss.hashicorp.com/t/i-am-in-a-dilenma-with-this-error-failed-to-query-available-provider-packages/59379>\
**Category:** Terraform\
**Created:** [October 22, 2023, 1:44am UTC](https://discuss.hashicorp.com/t/i-am-in-a-dilenma-with-this-error-failed-to-query-available-provider-packages/59379 "2023-10-22T01:44:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomiwaAribisala-git](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/tomiwaaribisala-git/32/38487_2.png) [@TomiwaAribisala-git](https://discuss.hashicorp.com/u/TomiwaAribisala-git)\
**Post date:** [October 22, 2023, 1:44am UTC](https://discuss.hashicorp.com/t/i-am-in-a-dilenma-with-this-error-failed-to-query-available-provider-packages/59379/1 "2023-10-22T01:44:07Z")

</div>

I am getting the error message below when I use the command “terraform init”:

```auto
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/user: provider registry registry.terraform.io does not have a provider
│ named registry.terraform.io/hashicorp/user
│
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which
│ modules are currently depending on hashicorp/user, run the following command:
│ terraform providers

```

I honestly don’t know where the hashicorp/user is coming from, the only required providers i have in my main.tf is below, i don’t know why its bringing up hashicorp/user instead only hashicorp/aws:

```auto
terraform {
  backend "s3" {
    bucket = "terraform-cloud-challenge-state-bucket"
    key = "global/s3/terraform.tfstate"
    region = "eu-north-1"
    #encrypt = true
    #dynamodb_table = "terraform-cloud-challenge-state-lock"
  }
}

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "5.22.0"
    }
  }
}

provider "aws" {
    region = "eu-north-1"
}

```

Please help!

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [October 23, 2023, 6:15pm UTC](https://discuss.hashicorp.com/t/i-am-in-a-dilenma-with-this-error-failed-to-query-available-provider-packages/59379/2 "2023-10-23T18:15:12Z")

</div>

Hi @TomiwaAribisala-git,

For backward compatibility with modules written for much older versions of Terraform, `terraform init` will guess that any resource whose type doesn’t start with a prefix that matches one of the explicitly-declared providers was intended to be a provider in the `hashicorp` namespace. (Older versions of Terraform didn’t have separate namespaces for providers at all, and most of the providers in the old “flat” naming scheme ended up in the `hashicorp` namespace.)

Given that, I’m guessing that somewhere in your configuration you have a declaration like this:

```auto
resource "user" "example" {

}

```

whereas you probably intended to write this:

```auto
resource "aws_iam_user" "example" {

}

```

Since there is no entry for `user` in your `required_providers` block, Terraform guesses that you intended to declare `user = { source = "hashicorp/user" }` and then tries to install that provider.

I would suggest searching your configuration for the sequence `resource "user` (closing quote intentionally omitted) to find any declarations you have where the resource type starts with “user”.
