{"record":{"id":"3281dd8fdd967408","repo":"hashicorp/terraform","slug":"missing-state-name-3281dd","errorCode":null,"errorMessage":"missing state name","messagePattern":"missing state name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oss/backend_state.go","lineNumber":31,"sourceCode":"\n\t\"github.com/aliyun/aliyun-oss-go-sdk/oss\"\n\t\"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore\"\n\n\t\"github.com/hashicorp/terraform/internal/backend\"\n\t\"github.com/hashicorp/terraform/internal/states\"\n\t\"github.com/hashicorp/terraform/internal/states/remote\"\n\t\"github.com/hashicorp/terraform/internal/states/statemgr\"\n\t\"github.com/hashicorp/terraform/internal/tfdiags\"\n)\n\nconst (\n\tlockFileSuffix = \".tflock\"\n)\n\n// get a remote client configured for this state\nfunc (b *Backend) remoteClient(name string) (*RemoteClient, error) {\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"missing state name\")\n\t}\n\n\tclient := &RemoteClient{\n\t\tossClient:            b.ossClient,\n\t\tbucketName:           b.bucketName,\n\t\tstateFile:            b.stateFile(name),\n\t\tlockFile:             b.lockFile(name),\n\t\tserverSideEncryption: b.serverSideEncryption,\n\t\tacl:                  b.acl,\n\t\totsTable:             b.otsTable,\n\t\totsClient:            b.otsClient,\n\t}\n\tif b.otsEndpoint != \"\" && b.otsTable != \"\" {\n\t\t_, err := b.otsClient.DescribeTable(&tablestore.DescribeTableRequest{\n\t\t\tTableName: b.otsTable,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn client, fmt.Errorf(\"error describing table store %s: %#v\", b.otsTable, err)","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/oss/backend_state.go#L13-L49","documentation":"Attribute.InternalValidate was called on a nil *Attribute pointer. The exported method guards the nil receiver and returns this error rather than panicking. Internally, a nil entry in a Block's Attributes map is caught earlier with a different message, so this specific message surfaces when callers invoke Attribute.InternalValidate directly on nil.","triggerScenarios":"Calling `var a *configschema.Attribute; a.InternalValidate(\"x\")`, or passing a nil attribute pointer through code that calls its InternalValidate. Guard at internal_validate.go:132 is `if a == nil`.","commonSituations":"Provider test helper that iterates attributes without nil-checking; refactoring that leaves an attribute pointer uninitialized before validation.","solutions":["Skip nil attribute pointers before calling InternalValidate, or initialize them.","When validating a whole Block, prefer Block.InternalValidate which already handles nil map entries.","Add a nil check at the call site and surface a clearer upstream error."],"exampleFix":"// before\nvar attr *configschema.Attribute\nif err := attr.InternalValidate(\"name\"); err != nil { return err }\n// after\nif attr == nil { return fmt.Errorf(\"name: attribute is nil\") }\nif err := attr.InternalValidate(\"name\"); err != nil { return err }","handlingStrategy":"type-guard","validationCode":"// Nil-check attribute pointers before calling InternalValidate.\nfor name, attr := range block.Attributes {\n    if attr == nil {\n        return fmt.Errorf(\"%s: attribute is nil\", name)\n    }\n    if err := attr.InternalValidate(name); err != nil { return err }\n}","typeGuard":"func attributeNotNil(a *configschema.Attribute) bool { return a != nil }","tryCatchPattern":null,"preventionTips":["Prefer Block.InternalValidate, which already handles nil map entries.","Never store nil *Attribute values in an Attributes map.","Initialize attribute maps with concrete pointers."],"tags":["schema-validation","configschema","nil-pointer","attribute","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}