{"record":{"id":"936c96bebd59a6b0","repo":"hashicorp/terraform","slug":"missing-state-name-936c96","errorCode":null,"errorMessage":"missing state name","messagePattern":"missing state name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/s3/backend_state.go","lineNumber":158,"sourceCode":"\n\tif name == backend.DefaultStateName || name == \"\" {\n\t\treturn diags.Append(fmt.Errorf(\"can't delete default state\"))\n\t}\n\n\tlog.Info(\"Deleting workspace\")\n\n\tclient, err := b.remoteClient(name)\n\tif err != nil {\n\t\treturn diags.Append(err)\n\t}\n\n\treturn diags.Append(client.Delete())\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\ts3Client:              b.s3Client,\n\t\tdynClient:             b.dynClient,\n\t\tbucketName:            b.bucketName,\n\t\tpath:                  b.path(name),\n\t\tserverSideEncryption:  b.serverSideEncryption,\n\t\tcustomerEncryptionKey: b.customerEncryptionKey,\n\t\tacl:                   b.acl,\n\t\tkmsKeyID:              b.kmsKeyID,\n\t\tddbTable:              b.ddbTable,\n\t\tskipS3Checksum:        b.skipS3Checksum,\n\t\tlockFilePath:          b.getLockFilePath(name),\n\t\tuseLockFile:           b.useLockFile,\n\t}\n\n\treturn client, nil","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/s3/backend_state.go#L140-L176","documentation":"Optional and Required are mutually exclusive on an Attribute. Optional means the user may omit the value; Required means the user must set it — the two cannot both be true. The validator rejects this contradiction outright.","triggerScenarios":"An Attribute with both Optional: true and Required: true. Guard at internal_validate.go:149 is `a.Optional && a.Required`.","commonSituations":"Flipping flags during a refactor and leaving both set; codegen merging two schema fragments that each set one flag.","solutions":["Choose Optional (user may set) or Required (user must set), not both.","If the provider should also supply a value, add Computed: true alongside Optional: true (Optional+Computed is allowed)."],"exampleFix":"// before\n\"name\": { Type: cty.String, Optional: true, Required: true },\n// after\n\"name\": { Type: cty.String, Required: true },","handlingStrategy":"validation","validationCode":"// Optional and Required are mutually exclusive.\nfunc notOptionalAndRequired(a *configschema.Attribute) bool {\n    return a == nil || !(a.Optional && a.Required)\n}","typeGuard":"func mutuallyExclusiveFlags(optional, required bool) bool { return !(optional && required) }","tryCatchPattern":null,"preventionTips":["Pick Optional or Required, never both.","Use Optional+Computed if you also want provider-supplied values.","Add a schema linter to catch contradictory flags."],"tags":["schema-validation","configschema","attribute","optional","required","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}