langgenius/dify · error · ValueError

Unsupported vector db type {vector_type}.

Error message

Unsupported vector db type {vector_type}.

What it means

ValueError raised at line 432 when vector_type is non-None but matches neither the semantic_only set, the full_search set, nor the special MILVUS/TIDB_VECTOR branches. This indicates a vector type unknown to this helper's enumeration (likely a new/unsupported backend or a typo in config).

Source

Thrown at api/controllers/console/datasets/datasets.py:432

        "retrieval_method": [
            RetrievalMethod.SEMANTIC_SEARCH.value,
            RetrievalMethod.FULL_TEXT_SEARCH.value,
            RetrievalMethod.HYBRID_SEARCH.value,
        ]
    }

    if vector_type == VectorType.MILVUS:
        return semantic_methods if is_mock else full_methods

    if vector_type == VectorType.TIDB_VECTOR:
        return full_methods if dify_config.TIDB_VECTOR_ENABLE_FULLTEXT_SEARCH else semantic_methods

    if vector_type in semantic_only_types:
        return semantic_methods
    elif vector_type in full_search_types:
        return full_methods
    else:
        raise ValueError(f"Unsupported vector db type {vector_type}.")


@console_ns.route("/datasets")
class DatasetListApi(Resource):
    @console_ns.doc("get_datasets")
    @console_ns.doc(description="Get list of datasets")
    @console_ns.doc(params=query_params_from_model(ConsoleDatasetListQuery))
    @console_ns.response(200, "Datasets retrieved successfully", console_ns.models[DatasetListResponse.__name__])
    @setup_required
    @login_required
    @account_initialization_required
    @enterprise_license_required
    @with_current_user
    @with_current_tenant_id
    @with_session(write=False)
    def get(self, session: Session, current_tenant_id: str, current_user: Account):
        # Convert query parameters to dict, handling list parameters correctly
        query_params: dict[str, str | list[str]] = dict(request.args.to_dict())

View on GitHub (pinned to ef8544b173)

Solutions

  1. Correct VECTOR_STORE to an exact VectorType member value (lowercase as defined in vector_type.py).
  2. If the backend is legitimately supported, add it to semantic_only_types or full_search_types in the helper.
  3. Confirm there is no leading/trailing whitespace or casing deviation in the env value.

Example fix

# before
VECTOR_STORE=Qdrant
# after
VECTOR_STORE=qdrant
Defensive patterns

Strategy: validation

Validate before calling

from api.core.rag.datasource.vdb.vector_type import VectorType

def is_known_vector_type(v) -> bool:
    try:
        VectorType(v)
        return True
    except ValueError:
        return False

Type guard

from api.core.rag.datasource.vdb.vector_type import VectorType

def is_supported_vector_type(v) -> bool:
    return v in {m.value for m in VectorType}

Prevention

When it happens

Trigger: Configuring VECTOR_STORE to a string that is not present in the VectorType StrEnum members handled by the helper (api/core/rag/datasource/vdb/vector_type.py lists supported names). E.g., a typo like 'qdrand', or a backend added to the enum but not yet wired into the retrieval-method sets.

Common situations: Typo in VECTOR_STORE env value; a newly added vector backend whose retrieval capabilities were not classified in semantic_only_types / full_search_types; mismatch between config casing and the StrEnum.

Related errors


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