{"record":{"id":"5d101c19673d87db","repo":"HKUDS/DeepTutor","slug":"deep-research-requires-an-explicit-config-object","errorCode":null,"errorMessage":"Deep research requires an explicit config object.","messagePattern":"Deep research requires an explicit config object\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/agents/research/request_config.py","lineNumber":55,"sourceCode":"    @classmethod\n    def validate_manual_subtopics(cls, value: int | None) -> int | None:\n        if value is not None:\n            return max(1, min(value, 10))\n        return value\n\n    @field_validator(\"manual_max_iterations\")\n    @classmethod\n    def validate_manual_max_iterations(cls, value: int | None) -> int | None:\n        if value is not None:\n            return max(1, min(value, 10))\n        return value\n\n\ndef validate_research_request_config(\n    raw_config: dict[str, Any] | None,\n) -> DeepResearchRequestConfig:\n    if not isinstance(raw_config, dict):\n        raise ValueError(\"Deep research requires an explicit config object.\")\n    try:\n        return DeepResearchRequestConfig.model_validate(raw_config)\n    except ValidationError as exc:\n        details = \"; \".join(\n            f\"{'.'.join(str(part) for part in error['loc'])}: {error['msg']}\"\n            for error in exc.errors()\n        )\n        raise ValueError(f\"Invalid deep research config: {details}\") from exc\n\n\ndef build_research_execution_policy(\n    *,\n    request_config: DeepResearchRequestConfig,\n) -> dict[str, Any]:\n    depth_policy = _build_depth_policy(\n        request_config.depth,\n        manual_max_iterations=request_config.manual_max_iterations,\n        manual_subtopics=request_config.manual_subtopics,","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/agents/research/request_config.py#L37-L73","documentation":"Generic validation guard in validate_research_request_config: raised when raw_config is not a dict (None or any non-mapping value). The deep-research pipeline requires an explicit configuration object; callers must pass a mapping, even a minimal empty dict.","triggerScenarios":"Thrown at deeptutor/agents/research/request_config.py:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a dict payload for the research config, e.g. {} for defaults","Fix the caller that forwards None or a non-mapping (check JSON body parsing)","Wrap with try/except ValueError at the API boundary and return a 422-style message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","contentChangedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}