{"record":{"id":"66d35e1060483d55","repo":"hashicorp/terraform","slug":"execution-halted","errorCode":null,"errorMessage":"execution halted","messagePattern":"execution halted","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/local/backend_apply.go","lineNumber":136,"sourceCode":"\t\t\treturn\n\t\t}\n\n\t\ttrivialPlan := !plan.Applyable\n\t\thasUI := op.UIOut != nil && op.UIIn != nil\n\t\tmustConfirm := hasUI && !op.AutoApprove && !trivialPlan\n\t\top.View.Plan(plan, schemas)\n\n\t\tif testHookStopPlanApply != nil {\n\t\t\ttestHookStopPlanApply()\n\t\t}\n\n\t\t// Check if we've been stopped before going through confirmation, or\n\t\t// skipping confirmation in the case of -auto-approve.\n\t\t// This can currently happen if a single stop request was received\n\t\t// during the final batch of resource plan calls, so no operations were\n\t\t// forced to abort, and no errors were returned from Plan.\n\t\tif stopCtx.Err() != nil {\n\t\t\tdiags = diags.Append(errors.New(\"execution halted\"))\n\t\t\trunningOp.Result = backendrun.OperationFailure\n\t\t\top.ReportResult(runningOp, diags)\n\t\t\treturn\n\t\t}\n\n\t\tif mustConfirm {\n\t\t\tvar desc, query string\n\t\t\tswitch op.PlanMode {\n\t\t\tcase plans.DestroyMode:\n\t\t\t\tif op.Workspace != \"default\" {\n\t\t\t\t\tquery = \"Do you really want to destroy all resources in workspace \\\"\" + op.Workspace + \"\\\"?\"\n\t\t\t\t} else {\n\t\t\t\t\tquery = \"Do you really want to destroy all resources?\"\n\t\t\t\t}\n\t\t\t\tdesc = \"Terraform will destroy all your managed infrastructure, as shown above.\\n\" +\n\t\t\t\t\t\"There is no undo. Only 'yes' will be accepted to confirm.\"\n\t\t\tcase plans.RefreshOnlyMode:\n\t\t\t\tif len(plan.ActionTargetAddrs) > 0 {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/local/backend_apply.go#L118-L154","documentation":"In NestingSingle mode MinItems must be 0 or 1 — at most one instance of the block is allowed. Values outside that range (e.g. 2, or negative) are invalid. This range check runs only when MinItems equals MaxItems (the prior check passed).","triggerScenarios":"NestingSingle with MinItems set to 2 or more (or negative), with MaxItems equal. Guard at internal_validate.go:78 is `blockS.MinItems < 0 || blockS.MinItems > 1`.","commonSituations":"Believing NestingSingle can require multiple blocks; arithmetic that produces a value > 1 for the single-block count.","solutions":["Set MinItems to 0 (optional) or 1 (required), keeping MaxItems equal.","Use NestingList or NestingSet if the user must provide multiple instances."],"exampleFix":"// before\n\"primary\": { Nesting: configschema.NestingSingle, MinItems: 2, MaxItems: 2 },\n// after\n\"primary\": { Nesting: configschema.NestingSingle, MinItems: 1, MaxItems: 1 },","handlingStrategy":"validation","validationCode":"// NestingSingle MinItems must be 0 or 1.\nfunc validSingleRange(nb *configschema.NestedBlock) bool {\n    return nb.Nesting != configschema.NestingSingle || (nb.MinItems >= 0 && nb.MinItems <= 1)\n}","typeGuard":"func isZeroOrOne(n int) bool { return n == 0 || n == 1 }","tryCatchPattern":null,"preventionTips":["Remember NestingSingle allows at most one instance.","Use NestingList/NestingSet for multi-instance blocks.","Validate range in a schema-builder helper."],"tags":["schema-validation","configschema","nestingsingle","minitems","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}