{"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/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote/backend_state.go#L231-L267","documentation":"Emitted by remoteClient.Unlock (backend_state.go:247-256) on the force-unlock branch where r.lockInfo is nil (the client has no recorded lock) and the provided `id` does not equal \"organization/workspace\". Force-unlock is only permitted when the caller supplies the canonical workspace identifier; any other value is rejected before Workspaces.ForceUnlock is invoked.","triggerScenarios":"Calling Unlock with no prior recorded lockInfo and an id that is not exactly \"<organization>/<workspace>\" — e.g. passing a raw workspace ID, a UUID, or an empty string when trying to force-unlock.","commonSituations":"User or automation runs `terraform force-unlock <wrong-id>` where the ID is the workspace's internal ID rather than the org/name canonical form; wrapper passes the wrong identifier format.","solutions":["Pass the canonical lock ID \"<organization>/<workspace>\" as shown in error 429's message to the force-unlock path.","Re-read the lock error to obtain the exact \"org/workspace\" string and use that verbatim.","If you have the internal workspace ID instead, look up org and name via the TFC API and reconstruct the canonical form."],"exampleFix":"// before\nclient.Unlock(\"ws-abc123\")  // internal ID, not canonical -> mismatch\n\n// after\nclient.Unlock(\"myorg/dev\")   // canonical \"organization/workspace\"","handlingStrategy":"validation","validationCode":"// Validate the canonical force-unlock id format before calling the API.\nwant := r.organization + \"/\" + r.workspace.Name\nif r.lockInfo == nil && id != want {\n    return fmt.Errorf(\"force-unlock id must be %q (got %q)\", want, id)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the canonical \"<organization>/<workspace>\" id shown in the lock error for force-unlock.","Do not pass the internal workspace ID (ws-...) to force-unlock.","If only the internal ID is known, look up org/name via the API to build the canonical form.","Copy the lock id verbatim from the lock-failure message."],"tags":["state","lock","force-unlock","concurrency"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}