{"record":{"id":"f24f611838439678","repo":"hashicorp/terraform","slug":"s-hard-failed","errorCode":null,"errorMessage":"%s hard failed.","messagePattern":"(.+?) hard failed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote/backend_common.go","lineNumber":445,"sourceCode":"\t\t\t\t\tline = append(line, l...)\n\t\t\t\t}\n\n\t\t\t\tif next || len(line) > 0 {\n\t\t\t\t\tb.CLI.Output(b.Colorize().Color(string(line)))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tswitch pc.Status {\n\t\tcase tfe.PolicyPasses:\n\t\t\tif (r.HasChanges && op.Type == backendrun.OperationTypeApply || i < len(r.PolicyChecks)-1) && b.CLI != nil {\n\t\t\t\tb.CLI.Output(\"\\n------------------------------------------------------------------------\")\n\t\t\t}\n\t\t\tcontinue\n\t\tcase tfe.PolicyErrored:\n\t\t\treturn fmt.Errorf(\"%s errored.\", msgPrefix)\n\t\tcase tfe.PolicyHardFailed:\n\t\t\treturn fmt.Errorf(\"%s hard failed.\", msgPrefix)\n\t\tcase tfe.PolicySoftFailed:\n\t\t\trunURL := fmt.Sprintf(runHeaderErr, b.hostname, b.organization, op.Workspace, r.ID)\n\n\t\t\tif op.Type == backendrun.OperationTypePlan || op.UIOut == nil || op.UIIn == nil ||\n\t\t\t\t!pc.Actions.IsOverridable || !pc.Permissions.CanOverride {\n\t\t\t\treturn fmt.Errorf(\"%s soft failed.\\n%s\", msgPrefix, runURL)\n\t\t\t}\n\n\t\t\tif op.AutoApprove {\n\t\t\t\tif _, err = b.client.PolicyChecks.Override(stopCtx, pc.ID); err != nil {\n\t\t\t\t\treturn generalError(fmt.Sprintf(\"Failed to override policy check.\\n%s\", runURL), err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\topts := &terraform.InputOpts{\n\t\t\t\t\tId:          \"override\",\n\t\t\t\t\tQuery:       \"\\nDo you want to override the soft failed policy check?\",\n\t\t\t\t\tDescription: \"Only 'override' will be accepted to override.\",\n\t\t\t\t}","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote/backend_common.go#L427-L463","documentation":"In checkPolicy(), when pc.Status == tfe.PolicyHardFailed. A 'hard' policy failure is a mandatory policy violation that cannot be overridden — the run is blocked and there is no override path, unlike PolicySoftFailed.","triggerScenarios":"checkPolicy() finds a policy check with PolicyHardFailed status: a policy marked as hard-mandatory (enforcement level 'hard' / 'advisory' excluded) was violated. No override UI/API path exists for hard failures.","commonSituations":"Configuration violates an organization-wide hard-mandatory policy (e.g. forbidden provider, required tags, cloud region restrictions); the team cannot bypass it because it's hard-mandatory.","solutions":["Read the policy logs printed before the error to see exactly which rule failed and why.","Change the configuration to satisfy the hard-mandatory policy (the only way forward for a hard failure).","If the policy itself is wrong, ask an org admin to correct or relax the policy's enforcement level."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isHardFailed(s tfe.PolicyStatus) bool {\n    return s == tfe.PolicyHardFailed\n}","tryCatchPattern":"if err := b.checkPolicy(stopCtx, cancelCtx, op, r); err != nil {\n    if strings.HasSuffix(err.Error(), \"hard failed.\") {\n        // non-overridable -> must fix configuration\n    }\n    return err\n}","preventionTips":["Treat hard-mandatory policies as build breakers and fix config immediately.","Use advisory/soft-mandatory levels where override flexibility is needed.","Review policy logs to understand exactly which hard rule was violated."],"tags":["policy","run","sentinel","hard-mandatory"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}