{"record":{"id":"3be9e298394c1762","repo":"langchain-ai/deepagents","slug":"workspace-configuration-is-too-large","errorCode":null,"errorMessage":"workspace configuration is too large","messagePattern":"workspace configuration is too large","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/workspace.py","lineNumber":116,"sourceCode":"    \"\"\"Return bounded canonical JSON and its SHA-256 fingerprint.\n\n    Raises:\n        TypeError: If the configuration is not an object.\n        ValueError: If it cannot be serialized or exceeds the size limit.\n    \"\"\"\n    if value is None:\n        value = {}\n    if not isinstance(value, dict):\n        msg = \"workspace_config must be an object\"\n        raise TypeError(msg)\n    try:\n        serialized = json.dumps(value, sort_keys=True, separators=(\",\", \":\"))\n    except (TypeError, ValueError) as exc:\n        msg = \"workspace configuration must be JSON serializable\"\n        raise ValueError(msg) from exc\n    if len(serialized) > _MAX_CONFIG_LENGTH:\n        msg = \"workspace configuration is too large\"\n        raise ValueError(msg)\n    return serialized, hashlib.sha256(serialized.encode()).hexdigest()\n\n\ndef _fingerprint(value: object) -> str:\n    serialized = json.dumps(value, sort_keys=True, separators=(\",\", \":\"))\n    return hashlib.sha256(serialized.encode()).hexdigest()\n\n\ndef resolve_workspace(\n    cwd: object,\n    workspace_config: object | None = None,\n    *,\n    config_fingerprint: str | None = None,\n) -> WorkspaceBinding:\n    \"\"\"Resolve and validate a client workspace claim.\n\n    Returns:\n        A canonical, fingerprinted binding including the resource policy.","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/workspace.py#L98-L134","documentation":"`canonical_workspace_config` enforces a maximum canonical serialized size (`_MAX_CONFIG_LENGTH`) so workspace binding rows and fingerprints stay bounded. This ValueError means the serialized config exceeded that limit.","triggerScenarios":"Calling `canonical_workspace_config`, `resolve_workspace`, `bind_thread_workspace`, or `require_thread_workspace` with a workspace_config dict whose compact JSON serialization exceeds `_MAX_CONFIG_LENGTH` (e.g. embedding large file contents, long path lists, or base64 blobs in the config).","commonSituations":"Inlining large allowlists or full directory trees into workspace config; accidentally passing the whole settings file instead of the workspace section; accumulating entries in the config over a long-lived session.","solutions":["Trim the config to essential small key/value settings","Move bulk data (file lists, blobs) out of workspace_config into the workspace itself or another store","Check `len(json.dumps(cfg, sort_keys=True, separators=(',', ':')))` before calling to confirm it fits"],"exampleFix":"// before\ncfg = {\"files\": [f for f in scan_entire_tree()]}  # huge\n// after\ncfg = {\"root\": str(root)}  # small, workspace scans its own tree","handlingStrategy":"validation","validationCode":"serialized_len = len(json.dumps(workspace_config or {}, sort_keys=True, separators=(\",\", \":\")))\nassert serialized_len <= 65536, \"workspace_config too large\"","typeGuard":null,"tryCatchPattern":"try:\n    resolve_workspace(cwd, workspace_config)\nexcept ValueError as exc:\n    if \"too large\" in str(exc):\n        workspace_config = reduce_config(workspace_config)\n        resolve_workspace(cwd, workspace_config)","preventionTips":["Keep workspace_config to small key/value settings","Never embed file contents or blobs in the config","Periodically prune accumulated config entries"],"tags":["workspace","config","limit-exceeded","validation"],"backgroundTag":"config-too-large","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}