{"record":{"id":"097493ea3be72230","repo":"hashicorp/terraform","slug":"missing-state-name","errorCode":null,"errorMessage":"missing state name","messagePattern":"missing state name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/kubernetes/backend_state.go","lineNumber":156,"sourceCode":"\t\tif err := stateMgr.PersistState(nil); err != nil {\n\t\t\tunlockErr := unlock(err)\n\t\t\treturn nil, diags.Append(unlockErr)\n\t\t}\n\n\t\t// Unlock, the state should now be initialized\n\t\tif err := unlock(nil); err != nil {\n\t\t\treturn nil, diags.Append(err)\n\t\t}\n\n\t}\n\n\treturn stateMgr, diags\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\tsecretClient, err := b.KubernetesSecretClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tleaseClient, err := b.KubernetesLeaseClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &RemoteClient{\n\t\tkubernetesSecretClient: secretClient,\n\t\tkubernetesLeaseClient:  leaseClient,\n\t\tnamespace:              b.namespace,\n\t\tlabels:                 b.labels,\n\t\tnameSuffix:             b.nameSuffix,","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/kubernetes/backend_state.go#L138-L174","documentation":"In NestingMap mode both MinItems and MaxItems must be 0. Map nesting keys blocks by label and does not use occurrence counts; setting either is a schema error. This mirrors the NestingGroup restriction.","triggerScenarios":"NestingMap with MinItems or MaxItems != 0. Guard at internal_validate.go:111 is `blockS.MinItems != 0 || blockS.MaxItems != 0`.","commonSituations":"Switching from NestingList to NestingMap without clearing the count fields; assuming a map needs a minimum number of entries.","solutions":["Set both MinItems: 0 and MaxItems: 0 on the NestingMap block.","If occurrence limits are required, use NestingList or NestingSet."],"exampleFix":"// before\n\"labels\": { Nesting: configschema.NestingMap, MinItems: 1, MaxItems: 5 },\n// after\n\"labels\": { Nesting: configschema.NestingMap, MinItems: 0, MaxItems: 0 },","handlingStrategy":"validation","validationCode":"// NestingMap must keep MinItems and MaxItems at 0.\nfunc validMapCounts(nb *configschema.NestedBlock) bool {\n    return nb.Nesting != configschema.NestingMap || (nb.MinItems == 0 && nb.MaxItems == 0)\n}","typeGuard":"func mapCountsZero(min, max int) bool { return min == 0 && max == 0 }","tryCatchPattern":null,"preventionTips":["NestingMap keys blocks by label; counts are not used.","When converting from NestingList, clear MinItems/MaxItems.","Use a per-mode schema builder that sets the right defaults."],"tags":["schema-validation","configschema","nestingmap","minitems","maxitems","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}