HKUDS/DeepTutor · error · ValueError

Invalid deep research config

Error message

Invalid deep research config: {details}

What it means

Raised when DeepResearchRequestConfig.model_validate rejects the supplied dict; the original pydantic ValidationError is flattened into a '; '-joined list of field-path/detail pairs appended to the message. Means one or more config fields failed type or constraint validation (e.g. out-of-range iteration/subtopic counts).

Solutions

  1. Read the {details} segment to identify the offending field paths
  2. Clamp manual_max_iterations / manual_subtopics to 1–10 before submitting
  3. Validate the payload client-side against the DeepResearchRequestConfig schema
  4. Catch ValueError in the caller and surface a structured field-error response
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/agents/research/request_config.py:63 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/864589a90a3324f6. Report an issue: GitHub.

Appendix: source

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

    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,
    )
    mode_policy = _build_mode_policy(request_config.mode, request_config.depth)

    if request_config.depth == "manual" and request_config.manual_subtopics is not None:
        n = request_config.manual_subtopics
        if mode_policy.get("decompose_mode") == "auto":
            mode_policy["auto_max_subtopics"] = n
        else:

View on GitHub (pinned to 3e82f13042)