HKUDS/DeepTutor · error · ValueError

At least one URL is required.

Error message

At least one URL is required.

What it means

Presence guard after URL coercion in _string_list: the argument had the right shape but resolved to zero URLs (empty list or empty string), and at least one URL is required for the ingest operation to do anything.

Solutions

  1. Include one or more non-empty URL strings in the urls argument
  2. Skip the tool call when no sources were gathered
  3. Strip/filter blank entries client-side before calling
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/capabilities/ima/tools.py:431 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/7b9fa3063eca8e6d. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/capabilities/ima/tools.py:431


def _no_binding_message(bindings: tuple[ImaBinding, ...]) -> str:
    if not bindings:
        return "No Tencent IMA knowledge base is attached to this turn; IMA tools are unavailable."
    names = ", ".join(binding.name for binding in bindings)
    return f"Specify which IMA knowledge base to use with kb_name. Attached: {names}."


def _string_list(value: Any) -> list[str]:
    if isinstance(value, str):
        candidates = [value]
    elif isinstance(value, (list, tuple)):
        candidates = [str(item) for item in value]
    else:
        raise ValueError("urls must be a list of strings.")
    urls = [item.strip() for item in candidates if str(item).strip()]
    if not urls:
        raise ValueError("At least one URL is required.")
    return urls


# IMA's API refuses these; failing locally keeps the model from reporting a
# confusing upstream error for something that was never going to work.
_UNSUPPORTED_URL_MARKERS: tuple[str, ...] = (
    "bilibili.com/video/",
    "youtube.com/watch",
    "youtu.be/",
)


def _is_supported_url(url: str) -> bool:
    lowered = url.lower()
    if not lowered.startswith(("http://", "https://")):
        return False
    return not any(marker in lowered for marker in _UNSUPPORTED_URL_MARKERS)

View on GitHub (pinned to 3e82f13042)