HKUDS/DeepTutor · error · ValueError

At least one URL is required.

Error message

At least one URL is required.

What it means

ValueError from IMA client import_urls: after stripping and deduplicating the input URL list, no valid URL remains. The IMA (Ingestion/Multimodal Archive) pipeline requires at least one URL per import call.

Source

Thrown at deeptutor/services/rag/pipelines/ima/client.py:222

            timeout=self._timeout,
            transport=self._transport,
        )

    # ----- writing --------------------------------------------------------

    async def import_urls(self, urls: list[str], *, folder_id: str = "") -> list[ImaImportedUrl]:
        """Add up to :data:`MAX_IMPORT_URLS` web pages to the bound library.

        IMA reports a per-URL verdict rather than failing the batch, so partial
        success is normal and is returned as-is for the caller to report.
        """
        cleaned: list[str] = []
        for raw in urls:
            url = str(raw or "").strip()
            if url and url not in cleaned:
                cleaned.append(url)
        if not cleaned:
            raise ValueError("At least one URL is required.")
        if len(cleaned) > MAX_IMPORT_URLS:
            raise ValueError(f"IMA accepts at most {MAX_IMPORT_URLS} URLs per call.")

        # ``folder_id`` is required here, and the root folder's id is the
        # knowledge base id itself.
        target = str(folder_id or "").strip() or self._config.knowledge_base_id
        data = await self._wire.post(
            "import_urls",
            {
                "urls": cleaned,
                "knowledge_base_id": self._config.knowledge_base_id,
                "folder_id": target,
            },
        )
        results = parse_imported_urls(data)
        if results:
            return results
        # Some responses acknowledge the batch without echoing per-URL rows.

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Validate and filter URLs client-side before calling import_urls; require at least one non-empty entry.
  2. Fix the upstream producer that builds the URL list.
  3. Retry the pipeline with actual URLs supplied.

Example fix

# before
urls = ["", "  "]
await client.import_urls(folder_id, urls)
# after
urls = [u for u in raw_urls if u and u.strip()]
if not urls: raise ValueError("no urls")
await client.import_urls(folder_id, urls)
Defensive patterns

Strategy: validation

Validate before calling

cleaned = [u for u in (str(r or "").strip() for r in urls) if u]
if not cleaned:
    raise InputError("at least one URL required")

Prevention

When it happens

Trigger: Calling the IMA run pipeline with an empty urls list, or a list of empty/whitespace-only strings; all entries falsy after str().strip().

Common situations: Frontend sending an empty array when the user submits without entering URLs; upstream scraping step producing empty strings; passing None inside the list.

Related errors


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