HKUDS/DeepTutor · error · ValueError

Deep research requires an explicit config object.

Error message

Deep research requires an explicit config object.

What it means

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.

Solutions

  1. Pass a dict payload for the research config, e.g. {} for defaults
  2. Fix the caller that forwards None or a non-mapping (check JSON body parsing)
  3. Wrap with try/except ValueError at the API boundary and return a 422-style message
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/agents/research/request_config.py:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/5d101c19673d87db. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/agents/research/request_config.py:55

    @classmethod
    def validate_manual_subtopics(cls, value: int | None) -> int | None:
        if value is not None:
            return max(1, min(value, 10))
        return value

    @field_validator("manual_max_iterations")
    @classmethod
    def validate_manual_max_iterations(cls, value: int | None) -> int | None:
        if value is not None:
            return max(1, min(value, 10))
        return value


def validate_research_request_config(
    raw_config: dict[str, Any] | None,
) -> DeepResearchRequestConfig:
    if not isinstance(raw_config, dict):
        raise ValueError("Deep research requires an explicit config object.")
    try:
        return DeepResearchRequestConfig.model_validate(raw_config)
    except ValidationError as exc:
        details = "; ".join(
            f"{'.'.join(str(part) for part in error['loc'])}: {error['msg']}"
            for error in exc.errors()
        )
        raise ValueError(f"Invalid deep research config: {details}") from exc


def build_research_execution_policy(
    *,
    request_config: DeepResearchRequestConfig,
) -> dict[str, Any]:
    depth_policy = _build_depth_policy(
        request_config.depth,
        manual_max_iterations=request_config.manual_max_iterations,
        manual_subtopics=request_config.manual_subtopics,

View on GitHub (pinned to 3e82f13042)