{"record":{"id":"ae9b32bcb739288c","repo":"langchain-ai/deepagents","slug":"thread-thread-id-has-no-workspace-binding","errorCode":null,"errorMessage":"thread {thread_id} has no workspace binding","messagePattern":"thread (.+?) has no workspace binding","errorType":"exception","errorClass":"WorkspaceConflictError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/workspace.py","lineNumber":358,"sourceCode":"        msg = \"workspace context is required\"\n        raise TypeError(msg)\n    data = cast(\"dict[str, Any]\", payload)\n    claimed_fingerprint = config_fingerprint\n    if workspace_config is not None:\n        _, claimed_fingerprint = canonical_workspace_config(workspace_config)\n\n    def _require() -> WorkspaceBinding:\n        with sqlite3.connect(_database_path(), timeout=5) as conn:\n            conn.row_factory = sqlite3.Row\n            conn.execute(\"BEGIN IMMEDIATE\")\n            _initialize(conn)\n            row = conn.execute(\n                \"SELECT * FROM dcode_thread_workspaces WHERE thread_id = ?\",\n                (thread_id,),\n            ).fetchone()\n            if row is None:\n                msg = f\"thread {thread_id} has no workspace binding\"\n                raise WorkspaceConflictError(msg)\n            existing = _row_binding(row)\n            expected = existing.to_payload()\n            if any(data.get(key) != value for key, value in expected.items()):\n                msg = f\"workspace context does not match thread {thread_id}\"\n                raise WorkspaceConflictError(msg)\n            if (\n                claimed_fingerprint is not None\n                and claimed_fingerprint != existing.config_fingerprint\n            ):\n                msg = f\"workspace configuration does not match thread {thread_id}\"\n                raise WorkspaceConflictError(msg)\n            return existing\n\n    existing = await asyncio.to_thread(_require)\n    if existing.schema_version != _SCHEMA_VERSION:\n        msg = f\"workspace binding schema is unsupported for thread {thread_id}\"\n        raise WorkspaceConflictError(msg)\n    resolved = await asyncio.to_thread(","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/workspace.py#L340-L376","documentation":"Inside `require_thread_workspace._require`, the code looks up the thread's row in `dcode_thread_workspaces`. This `WorkspaceConflictError` is raised when no binding row exists for the thread, so the claimed workspace context cannot be verified against anything.","triggerScenarios":"Calling `require_thread_workspace` for a thread_id that was never passed through `bind_thread_workspace`; using a thread id whose row was deleted or whose database file was replaced; pointing at a fresh DB with an old thread id.","commonSituations":"Restoring from a partial backup missing the workspaces table; running the agent against a different project/state directory where the binding DB is empty; replaying recorded thread ids in a new environment.","solutions":["Call `bind_thread_workspace` for the thread before running, so a binding exists","Verify you are opening the same database/state directory the thread was bound in","Recreate the session with a new thread id if the original state is gone"],"exampleFix":"// before\nrequire_thread_workspace(thread_id=new_tid, payload=ctx)  # never bound\n// after\nbinding = await bind_thread_workspace(thread_id=new_tid, cwd=cwd, workspace_config=cfg)\nrequire_thread_workspace(thread_id=new_tid, payload=binding.to_payload())","handlingStrategy":"try-catch","validationCode":"# ensure binding exists before requiring it\nawait bind_thread_workspace(thread_id, cwd, workspace_config=cfg)","typeGuard":null,"tryCatchPattern":"try:\n    await require_thread_workspace(tid, payload=ctx)\nexcept WorkspaceConflictError as exc:\n    if \"no workspace binding\" in str(exc):\n        binding = await bind_thread_workspace(tid, cwd)\n        await require_thread_workspace(tid, payload=binding.to_payload())","preventionTips":["Bind the thread before its first run","Open the same state/DB directory the thread was created in","Recreate sessions lost to backup gaps"],"tags":["workspace","conflict","binding","thread"],"backgroundTag":"no-workspace-binding","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}