{"record":{"id":"3faedea9cba4326a","repo":"hashicorp/terraform","slug":"lock-id-q-does-not-match-existing-lock-id-s-s","errorCode":null,"errorMessage":"lock ID %q does not match existing lock ID \"%s/%s\"","messagePattern":"lock ID %q does not match existing lock ID \"(.+?)/(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote/backend_state.go","lineNumber":249,"sourceCode":"\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// This will not be retried\n\t\t\t\treturn &errorUnlockFailed{innerError: err}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\tlockErr.Err = err\n\t\t\treturn lockErr\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Verify the optional force-unlock lock ID.\n\tif r.organization+\"/\"+r.workspace.Name != id {\n\t\tlockErr.Err = fmt.Errorf(\n\t\t\t\"lock ID %q does not match existing lock ID \\\"%s/%s\\\"\",\n\t\t\tid,\n\t\t\tr.organization,\n\t\t\tr.workspace.Name,\n\t\t)\n\t\treturn lockErr\n\t}\n\n\t// Force unlock the workspace.\n\t_, err := r.client.Workspaces.ForceUnlock(ctx, r.workspace.ID)\n\tif err != nil {\n\t\tlockErr.Err = err\n\t\treturn lockErr\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote/backend_state.go#L231-L267","documentation":"Force-unlock path taken when r.lockInfo is nil (no tracked lock). Terraform requires the supplied id to equal \"<organization>/<workspace>\"; otherwise it refuses to force-unlock the wrong workspace. Returned as a statemgr.LockError.","triggerScenarios":"r.lockInfo == nil and the user-supplied id != org/workspace: someone passed an arbitrary string to force-unlock instead of the documented org/workspace lock identifier.","commonSituations":"Running `terraform force-unlock <wrong-id>` after a crash; copy-paste of a run ID instead of the org/workspace string.","solutions":["Run `terraform force-unlock \"<organization>/<workspace>\"` using the exact org and workspace name.","Confirm the spelling and casing of org and workspace match the backend config.","If you do have the original lock ID, use the normal unlock path instead of force-unlock."],"exampleFix":"// before\n$ terraform force-unlock my-run-id\n// after\n$ terraform force-unlock \"my-org/my-workspace\"","handlingStrategy":"validation","validationCode":"// Validate the force-unlock id format before calling ForceUnlock\nexpected := org + \"/\" + workspaceName\nif id != expected {\n    return fmt.Errorf(\"force-unlock id must be %q, got %q\", expected, id)\n}","typeGuard":"func isValidForceUnlockId(id, org, ws string) bool {\n    return id == org+\"/\"+ws\n}","tryCatchPattern":null,"preventionTips":["Use the documented `terraform force-unlock \"<org>/<workspace>\"` form.","Double-check org/workspace casing against the backend config.","Prefer normal Unlock when the original lock ID is available."],"tags":["terraform","remote-backend","tfe","locking","force-unlock"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}