iflytek/astron-agent · error · ProtocolParamException

chunkIds is not empty

Error message

chunkIds is not empty

What it means

chunks_delete validates that a non-empty chunkIds list is supplied; check_not_empty failing raises ProtocolParamException('chunkIds is not empty') before invoking xinghuo.dataset_delchunk. Deleting with no target chunk IDs is treated as a caller bug.

Solutions

  1. Ensure chunkIds contains at least one chunk id before calling chunks_delete()
  2. Guard the call site: skip or no-op the delete when the id list is empty
  3. Check the selection/fetch logic that builds chunkIds — it may be dropping ids
  4. Verify the chunks still exist; if already deleted, treat the operation as complete instead of calling the API

Example fix

// before
await strategy.chunks_delete(chunkIds=chunk_ids)
// after
if chunk_ids:
    await strategy.chunks_delete(chunkIds=chunk_ids)
Defensive patterns

Strategy: validation

Validate before calling

if not chunk_ids:
    return {"deleted": 0}  # no-op instead of calling the API

Type guard

def has_chunk_ids(v) -> bool:
    return isinstance(v, (list, tuple)) and len(v) > 0 and all(isinstance(i, str) and i for i in v)

Try / catch

try:
    await strategy.chunks_delete(chunkIds=ids)
except ProtocolParamException:
    logger.info("No chunk ids to delete; skipping")

Prevention

When it happens

Trigger: Calling chunks_delete() with chunkIds=None or [] — e.g. the UI allowed deleting with nothing selected, or the chunk list was emptied by a prior filter.

Common situations: Frontend submitting a delete request with no checkboxes selected; chunks already deleted so the filtered id list is empty; id field name mismatch leaving the list unset.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/b9ecbc02bc16a0f4. Report an issue: GitHub.

Appendix: source

Thrown at core/knowledge/service/impl/cbg_strategy.py:317

    async def chunks_delete(
        self, docId: str, chunkIds: List[str], **kwargs: Any
    ) -> Any:
        """
        Delete chunks

        Args:
            docId: Document ID
            chunkIds: Chunk ID list
            **kwargs: Other parameters

        Returns:
            Delete result

        Raises:
            ProtocolParamException: When chunkIds is empty
        """
        if not check_not_empty(chunkIds):
            raise ProtocolParamException(msg="chunkIds is not empty")

        return await xinghuo.dataset_delchunk(chunk_ids=chunkIds, **kwargs)

    async def query_doc(self, docId: str, **kwargs: Any) -> List[dict]:
        """
        Query all chunks of a document

        Args:
            docId: Document ID
            **kwargs: Other parameters

        Returns:
            List of chunk information
        """
        result: List[dict] = []
        datas = await xinghuo.get_chunks(file_id=docId, **kwargs)

        for data in datas:

View on GitHub (pinned to 5e758547a8)