{"record":{"id":"3b52ae3745b0bf7f","repo":"rohitg00/ai-engineering-from-scratch","slug":"record-root-must-be-an-object","errorCode":null,"errorMessage":"record root must be an object","messagePattern":"record root must be an object","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/01-claude-product-and-model-landscape/code/main.py","lineNumber":209,"sourceCode":"    return isinstance(value, str) and value.startswith(OFFICIAL_DOC_PREFIXES)\n\n\ndef _nonempty_strings(value: Any) -> bool:\n    return isinstance(value, list) and bool(value) and all(isinstance(item, str) and item.strip() for item in value)\n\n\ndef _iso_date(value: Any) -> bool:\n    try:\n        date.fromisoformat(value)\n        return isinstance(value, str)\n    except (TypeError, ValueError):\n        return False\n\n\ndef load_record(path: Path) -> dict[str, Any]:\n    value = json.loads(path.read_text(encoding=\"utf-8\"))\n    if not isinstance(value, dict):\n        raise ValueError(\"record root must be an object\")\n    return value\n\n\nif __name__ == \"__main__\":\n    path = Path(__file__).parents[1] / \"outputs\" / \"product-selection-record.json\"\n    record = load_record(path)\n    print(json.dumps({\"valid\": not validate_record(record), \"recommendation\": recommend(record)}, indent=2))\n","sourceCodeStart":191,"sourceCodeEnd":217,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/01-claude-product-and-model-landscape/code/main.py#L191-L217","documentation":"JSON-RPC request validation (error code -32602, invalid params): validateRequest found msg.params is not a plain object — it is missing, an array, or a primitive. The dispatcher reads named fields off params, so the request cannot be routed to a tool and is rejected before execution.","triggerScenarios":"Thrown at certifications/claude/lessons/01-claude-product-and-model-landscape/code/main.py:209 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send params as a JSON object, e.g. {\"name\": \"...\", \"arguments\": {}}","Default missing params to {} at the transport edge if your method allows it","Return the -32602 error to the client with the received params echoed for debugging"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}