langgenius/dify · error · ValueError

invalid_param

invalid_param

Error message

Summary generation is only available for 'high_quality' indexing technique. Current indexing technique: {dataset.indexing_technique}

What it means

Raised as a ValueError (surfaced as invalid_param) by the POST generate-summary endpoint when the target dataset's indexing_technique is not 'high_quality'. Summary generation builds over vector segments, which only exist under high_quality indexing; economy-indexed datasets have no embeddings to summarize. The check at datasets_document.py:1692 short-circuits before any task is dispatched.

Source

Thrown at api/controllers/console/datasets/datasets_document.py:1693

            raise Forbidden()

        try:
            DatasetService.check_dataset_permission(dataset, current_user, session)
        except services.errors.account.NoPermissionError as e:
            raise Forbidden(str(e))

        # Validate request payload
        payload = GenerateSummaryPayload.model_validate(console_ns.payload or {})
        document_list = payload.document_list

        if not document_list:
            from werkzeug.exceptions import BadRequest

            raise BadRequest("document_list cannot be empty.")

        # Check if dataset configuration supports summary generation
        if dataset.indexing_technique != IndexTechniqueType.HIGH_QUALITY:
            raise ValueError(
                f"Summary generation is only available for 'high_quality' indexing technique. "
                f"Current indexing technique: {dataset.indexing_technique}"
            )

        summary_index_setting = dataset.summary_index_setting
        if not summary_index_setting or not summary_index_setting.get("enable"):
            raise ValueError("Summary index is not enabled for this dataset. Please enable it in the dataset settings.")

        # Verify all documents exist and belong to the dataset
        documents = DocumentService.get_documents_by_ids(
            DatasetRefService.create_dataset_ref(dataset), document_list, session
        )

        if len(documents) != len(document_list):
            found_ids = {doc.id for doc in documents}
            missing_ids = set(document_list) - found_ids
            raise NotFound(f"Some documents not found: {list(missing_ids)}")

View on GitHub (pinned to ef8544b173)

Solutions

  1. Switch the dataset to high_quality indexing (re-index with IndexTechniqueType.HIGH_QUALITY) before invoking summary generation.
  2. Before calling the endpoint, GET the dataset and assert dataset['indexing_technique'] == 'high_quality'; abort the summary flow otherwise.
  3. In the UI, disable the 'Generate Summary' action for economy datasets so the request is never sent.

Example fix

# before
resp = client.post(f'/datasets/{dataset_id}/generate-summary', json={'document_list': doc_ids})

# after
ds = client.get(f'/datasets/{dataset_id}').json()
if ds['indexing_technique'] != 'high_quality':
    raise RuntimeError('cannot generate summaries on a non-high_quality dataset')
resp = client.post(f'/datasets/{dataset_id}/generate-summary', json={'document_list': doc_ids})
Defensive patterns

Strategy: validation

Validate before calling

def can_generate_summary(dataset: dict) -> bool:
    return dataset.get('indexing_technique') == 'high_quality'

ds = client.get(f'/console/api/datasets/{dataset_id}').json()
assert can_generate_summary(ds), f"indexing_technique={ds.get('indexing_technique')} is not high_quality"

Type guard

from typing import TypedDict

class DatasetRef(TypedDict):
    id: str
    indexing_technique: str | None

def is_high_quality(d: DatasetRef) -> bool:
    return d.get('indexing_technique') == 'high_quality'

Try / catch

try:
    client.post(f'/datasets/{dataset_id}/generate-summary', json=payload)
except HTTPError as e:
    if e.response.status_code == 400 and 'high_quality' in e.response.text:
        # prompt user to switch indexing; do not retry unchanged
        ...

Prevention

When it happens

Trigger: POST /console/api/datasets/{dataset_id}/generate-summary (or the matching route wrapping DocumentSummaryGenerateApi) with a dataset whose indexing_technique column is 'economy' or null. Payload like {"document_list": ["<doc-id>"]} on such a dataset hits this guard immediately after the document_list emptiness check.

Common situations: Dataset was created with 'Economical' indexing in the UI; a frontend summary button was enabled without re-checking indexing mode; a dataset was migrated/downgraded from high_quality to economy; calling the summary API against an older dataset created before summary index existed.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/d3d0d81ca702ab97. Report an issue: GitHub.