{"record":{"id":"dd98717a18688ecd","repo":"hashicorp/terraform","slug":"identity-schema-not-found-for-type-s-dd9871","errorCode":null,"errorMessage":"identity schema not found for type %s","messagePattern":"identity schema not found for type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/grpcwrap/provider6.go","lineNumber":302,"sourceCode":"\tty := resSchema.Body.ImpliedType()\n\n\tstateVal, err := decodeDynamicValue6(req.CurrentState, ty)\n\tif err != nil {\n\t\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)\n\t\treturn resp, nil\n\t}\n\n\tmetaTy := p.schema.ProviderMeta.Body.ImpliedType()\n\tmetaVal, err := decodeDynamicValue6(req.ProviderMeta, metaTy)\n\tif err != nil {\n\t\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)\n\t\treturn resp, nil\n\t}\n\n\tvar currentIdentity cty.Value\n\tif req.CurrentIdentity != nil && req.CurrentIdentity.IdentityData != nil {\n\t\tif resSchema.Identity == nil {\n\t\t\treturn resp, fmt.Errorf(\"identity schema not found for type %s\", req.TypeName)\n\t\t}\n\n\t\tcurrentIdentity, err = decodeDynamicValue6(req.CurrentIdentity.IdentityData, resSchema.Identity.ImpliedType())\n\t\tif err != nil {\n\t\t\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)\n\t\t\treturn resp, nil\n\t\t}\n\t}\n\n\treadResp := p.provider.ReadResource(providers.ReadResourceRequest{\n\t\tTypeName:        req.TypeName,\n\t\tPriorState:      stateVal,\n\t\tPrivate:         req.Private,\n\t\tProviderMeta:    metaVal,\n\t\tCurrentIdentity: currentIdentity,\n\t})\n\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, readResp.Diagnostics)\n\tif readResp.Diagnostics.HasErrors() {","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/grpcwrap/provider6.go#L284-L320","documentation":"Returned by the tfplugin6 ReadResource handler when core sent a non-nil CurrentIdentity but the resource schema has no Identity block (resSchema.Identity == nil). The wrapper cannot decode identity bytes without a target type, so it refuses the read.","triggerScenarios":"req.CurrentIdentity != nil && req.CurrentIdentity.IdentityData != nil while p.schema.ResourceTypes[req.TypeName].Identity == nil.","commonSituations":"Terraform core version supports resource identity and forwards identity data, but the provider (or this resource type) predates identity support or did not declare an identity schema; state carries identity for a resource whose schema dropped it.","solutions":["Upgrade the provider to a version that declares an identity schema for the resource.","If developing the provider, add the Identity block to the resource schema.","Align terraform core and provider versions so both understand identity for the type.","Remove stale identity from state if the resource legitimately no longer supports identity."],"exampleFix":"// before: resource schema has no identity\nresSchema.Identity = nil\n// after\nresSchema.Identity = identityConfigSchema","handlingStrategy":"validation","validationCode":"// Before forwarding CurrentIdentity on a ReadResource RPC, ensure the type declares identity.\nschemas, err := client.GetProviderSchema(ctx, &tfplugin6.GetProviderSchema_Request{})\nif err != nil {\n    return err\n}\nresSchema, ok := schemas.ResourceTypes[typeName]\nif !ok || resSchema.Identity == nil {\n    // do not send CurrentIdentity for this type\n    req.CurrentIdentity = nil\n}\nreturn client.ReadResource(ctx, req)","typeGuard":"func hasIdentitySchema(s *tfplugin6.Schema, typeName string) bool {\n    r, ok := s.ResourceTypes[typeName]\n    return ok && r.Identity != nil\n}","tryCatchPattern":null,"preventionTips":["Gate identity forwarding on a live schema introspection that checks the Identity block.","Keep core and provider versions aligned on identity support.","Drop identity from requests when the target schema lacks an Identity block."],"tags":["terraform","provider","schema","identity","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"}