{"record":{"id":"17f60178629aa6cc","repo":"langchain-ai/deepagents","slug":"source-display-path-path-malformed-tools-j-17f601","errorCode":null,"errorMessage":"{source}: {_display_path(path)}: malformed tools.json: expected tools list","messagePattern":"(.+?): (.+?): malformed tools\\.json: expected tools list","errorType":"error_code","errorClass":"FleetImportError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/fleet_import.py","lineNumber":366,"sourceCode":"\n\ndef _load_tool_requests(path: Path, scope: str, source: Path) -> list[_ToolRequest]:\n    try:\n        data = json.loads(path.read_text(encoding=\"utf-8\"))\n    except json.JSONDecodeError as exc:\n        msg = f\"{source}: {_display_path(path)}: malformed tools.json: {exc.msg}\"\n        raise FleetImportError(msg) from exc\n    except OSError as exc:\n        msg = f\"{source}: {_display_path(path)}: {exc}\"\n        raise FleetImportError(msg) from exc\n    if not isinstance(data, dict):\n        msg = f\"{source}: {_display_path(path)}: malformed tools.json: expected object\"\n        raise FleetImportError(msg)\n\n    raw_tools = data.get(\"tools\")\n    if not isinstance(raw_tools, list):\n        msg = f\"{source}: {_display_path(path)}: malformed tools.json: expected tools list\"\n        raise FleetImportError(msg)\n    interrupt_config = data.get(\"interrupt_config\")\n    interrupts = interrupt_config if isinstance(interrupt_config, dict) else {}\n\n    requests: list[_ToolRequest] = []\n    for index, item in enumerate(raw_tools):\n        if not isinstance(item, dict):\n            msg = f\"{source}: {_display_path(path)}: tools[{index}] must be an object\"\n            raise FleetImportError(msg)\n        tool = cast(\"Mapping[str, object]\", item)\n        name = _required_str(tool, \"name\", path, index, source)\n        server_url = _sanitize_server_url(\n            _required_str(tool, \"mcp_server_url\", path, index, source)\n        )\n        server_name = _required_str(tool, \"mcp_server_name\", path, index, source)\n        requests.append(\n            _ToolRequest(\n                name=name,\n                server_url=server_url,","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/fleet_import.py#L348-L384","documentation":"FleetImportError raised by _load_tool_requests while parsing a tools.json for fleet MCP import. The file was valid JSON and a valid object, but its top-level 'tools' key is missing or not a list. The library requires an explicit JSON array of tool request objects.","triggerScenarios":"Calling _mcp_summaries/_load_tool_requests on a tools.json whose 'tools' key is absent, set to null, or is a dict/string instead of a JSON array.","commonSituations":"Hand-edited or partial fleet export files; a tools.json written as a bare object '{\"tool\": ...}' instead of '{\"tools\": [...]}'; schema drift between talon versions; truncated/merged config files.","solutions":["Open the tools.json at the displayed path and add a top-level 'tools' key containing a JSON array","If the file is a different schema version, regenerate it with the matching fleet export tooling","Validate the JSON structure with a schema check before importing"],"exampleFix":"// before\n{\"mcpUrl\": \"https://example.com\"}\n// after\n{\"tools\": [{\"name\": \"my-tool\", \"mcp_server_url\": \"https://example.com\", \"mcp_server_name\": \"example\"}]}","handlingStrategy":"validation","validationCode":"import json\ndata = json.loads(path.read_text())\nif not isinstance(data.get(\"tools\"), list):\n    raise ValueError(f\"{path}: 'tools' must be a list\")","typeGuard":"def has_tools_list(data: object) -> TypeGuard[dict[str, list[object]]]:\n    return isinstance(data, dict) and isinstance(data.get(\"tools\"), list)","tryCatchPattern":"try:\n    summaries = _mcp_summaries(...)\nexcept FleetImportError as exc:\n    logger.error(\"Invalid fleet tools.json: %s\", exc)\n    return []","preventionTips":["Validate tools.json against the expected schema in CI","Regenerate the file with official export tooling rather than hand-editing","Add a startup schema check before import"],"tags":["json","config","validation","mcp"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}