{"record":{"id":"9a56f6100ea77f87","repo":"hashicorp/terraform","slug":"invalid-lock-id","errorCode":null,"errorMessage":"invalid lock id","messagePattern":"invalid lock id","errorType":"console","errorClass":"LockError","httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/inmem/backend.go","lineNumber":213,"sourceCode":"\treturn info.ID, nil\n}\n\nfunc (l *lockMap) unlock(name, id string) error {\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tlockInfo := l.m[name]\n\n\tif lockInfo == nil {\n\t\treturn errors.New(\"state not locked\")\n\t}\n\n\tlockErr := &statemgr.LockError{\n\t\tInfo: &statemgr.LockInfo{},\n\t}\n\n\tif id != lockInfo.ID {\n\t\tlockErr.Err = errors.New(\"invalid lock id\")\n\t\t*lockErr.Info = *lockInfo\n\t\treturn lockErr\n\t}\n\n\tdelete(l.m, name)\n\treturn nil\n}\n","sourceCodeStart":195,"sourceCodeEnd":221,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/inmem/backend.go#L195-L221","documentation":"In NestingList or NestingSet mode, Computed cannot be combined with MinItems > 0. A computed block is populated by the provider, so forcing the user to supply a minimum number of instances is contradictory. The validator rejects Computed blocks that also demand at least one element.","triggerScenarios":"NestingList/NestingSet with Computed: true and MinItems >= 1. Guard at internal_validate.go:107 is `blockS.MinItems > 0 && blockS.Computed`.","commonSituations":"Marking a previously-required block as Computed without zeroing MinItems; wanting provider-managed output but still requiring config input.","solutions":["Set MinItems: 0 when the block is Computed.","If a minimum count is mandatory, set Computed: false and let the user supply the instances."],"exampleFix":"// before\n\"outputs\": {\n  Nesting: configschema.NestingList,\n  MinItems: 1,\n  Block: configschema.Block{Computed: true},\n},\n// after\n\"outputs\": {\n  Nesting: configschema.NestingList,\n  MinItems: 0,\n  Block: configschema.Block{Computed: true},\n},","handlingStrategy":"validation","validationCode":"// In NestingList/NestingSet, Computed forbids MinItems > 0.\nfunc validListSetComputed(nb *configschema.NestedBlock) bool {\n    switch nb.Nesting {\n    case configschema.NestingList, configschema.NestingSet:\n        return !(nb.Computed && nb.MinItems > 0)\n    }\n    return true\n}","typeGuard":"func computedAllowsMin(computed bool, min int) bool { return !computed || min == 0 }","tryCatchPattern":null,"preventionTips":["When marking a list/set block Computed, set MinItems to 0.","Do not require user-supplied instances on a provider-populated block.","Validate with InternalValidate in provider unit tests."],"tags":["schema-validation","configschema","computed","minitems","nestinglist","nestingset","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}