{"record":{"id":"86e1c9b7ef5f563c","repo":"hashicorp/terraform","slug":"resource-schema-not-found-for-type-q","errorCode":null,"errorMessage":"resource schema not found for type %q","messagePattern":"resource schema not found for type %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/grpcwrap/provider.go","lineNumber":787,"sourceCode":"\tif upgradeResp.Diagnostics.HasErrors() {\n\t\treturn resp, nil\n\t}\n\n\tdv, err := encodeDynamicValue(upgradeResp.UpgradedIdentity, ty)\n\tif err != nil {\n\t\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)\n\t\treturn resp, nil\n\t}\n\tresp.UpgradedIdentity = &tfplugin5.ResourceIdentityData{\n\t\tIdentityData: dv,\n\t}\n\treturn resp, nil\n}\n\nfunc (p *provider) ListResource(req *tfplugin5.ListResource_Request, res tfplugin5.Provider_ListResourceServer) error {\n\tresourceSchema, ok := p.schema.ResourceTypes[req.TypeName]\n\tif !ok {\n\t\treturn fmt.Errorf(\"resource schema not found for type %q\", req.TypeName)\n\t}\n\tlistSchema, ok := p.schema.ListResourceTypes[req.TypeName]\n\tif !ok {\n\t\treturn fmt.Errorf(\"list resource schema not found for type %q\", req.TypeName)\n\t}\n\tcfg, err := decodeDynamicValue(req.Config, listSchema.Body.ImpliedType())\n\tif err != nil {\n\t\treturn status.Errorf(codes.InvalidArgument, \"failed to decode config: %v\", err)\n\t}\n\tresp := p.provider.ListResource(providers.ListResourceRequest{\n\t\tTypeName:              req.TypeName,\n\t\tConfig:                cfg,\n\t\tLimit:                 req.Limit,\n\t\tIncludeResourceObject: req.IncludeResourceObject,\n\t})\n\tif resp.Diagnostics.HasErrors() {\n\t\treturn resp.Diagnostics.Err()\n\t}","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/grpcwrap/provider.go#L769-L805","documentation":"Returned by the tfplugin5 ListResource handler when the requested resource type is not registered in the provider's schema map (p.schema.ResourceTypes). Terraform core asked the provider to list instances of a type the provider never advertised, so the wrapper has no schema to decode the config against and aborts before calling the inner provider.","triggerScenarios":"A ListResource RPC arrives whose req.TypeName is absent from p.schema.ResourceTypes; the map lookup returns ok=false and the handler returns this error immediately.","commonSituations":"Provider version that does not contain the resource; typo'd resource type in HCL; terraform core built against a newer schema than the running provider; a built-in/internal provider that forgot to register the type in schema.ResourceTypes.","solutions":["Run `terraform providers schema -json` and confirm the type is advertised by the active provider version.","Correct the resource type spelling in the configuration to match the provider exactly.","Upgrade (or pin) the provider to the version that registers the resource type.","If developing a built-in provider exposed via grpcwrap, add the type to the schema.ResourceTypes map returned by GetProviderSchema."],"exampleFix":"// before: resource type never registered\nproviderSchema.ResourceTypes = map[string]*config.Block{}\n// after\nproviderSchema.ResourceTypes = map[string]*config.Block{\n    \"aws_example_thing\": exampleResourceSchema,\n}","handlingStrategy":"validation","validationCode":"// Before issuing a ListResource RPC, confirm the type is registered.\nschemas, err := client.GetProviderSchema(ctx, &tfplugin5.GetProviderSchema_Request{})\nif err != nil {\n    return err\n}\nif _, ok := schemas.ResourceTypes[typeName]; !ok {\n    return fmt.Errorf(\"will not call ListResource: type %q not registered by provider\", typeName)\n}\nreturn client.ListResource(ctx, typeName, config)","typeGuard":"// Guard that the provider schema actually contains the resource type.\nfunc resourceTypeRegistered(s *tfplugin5.GetProviderSchema_Response, typeName string) bool {\n    _, ok := s.ResourceTypes[typeName]\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Always reconcile expected resource types against GetProviderSchema before calling ListResource.","Pin provider versions in .terraform.lock.hcl so schema drift is caught at init.","Run `terraform providers schema -json` in CI to assert the type exists."],"tags":["terraform","provider","schema","resource","list-resource","grpc","version-mismatch"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}