assafelovic/gpt-researcher · error · ValueError

Set EMBEDDING = '<embedding_provider>:<embedding_model>' Eg

Error message

Set EMBEDDING = '<embedding_provider>:<embedding_model>' Eg 'openai:text-embedding-3-large'

What it means

Config.parse_embedding parses EMBEDDING as '<embedding_provider>:<embedding_model>'. A missing colon makes partition fail with ValueError, which is re-raised as this instructive message.

Source

Thrown at gpt_researcher/config/config.py:248

            raise ValueError(f"Invalid reasoning effort: {reasoning_effort_str}. Valid options are: {', '.join([effort.value for effort in ReasoningEfforts])}")
        return reasoning_effort_str

    @staticmethod
    def parse_embedding(embedding_str: str | None) -> tuple[str | None, str | None]:
        """Parse embedding string into (embedding_provider, embedding_model)."""
        from gpt_researcher.memory.embeddings import _SUPPORTED_PROVIDERS

        if embedding_str is None:
            return None, None
        try:
            embedding_provider, embedding_model = embedding_str.split(":", 1)
            assert embedding_provider in _SUPPORTED_PROVIDERS, (
                f"Unsupported {embedding_provider}.\nSupported embedding providers are: "
                + ", ".join(_SUPPORTED_PROVIDERS)
            )
            return embedding_provider, embedding_model
        except ValueError:
            raise ValueError(
                "Set EMBEDDING = '<embedding_provider>:<embedding_model>' "
                "Eg 'openai:text-embedding-3-large'"
            )

    def validate_doc_path(self):
        """Ensure that the folder exists at the doc path"""
        os.makedirs(self.doc_path, exist_ok=True)

    @staticmethod
    def convert_env_value(key: str, env_value: str, type_hint: Type) -> Any:
        """Convert environment variable to the appropriate type based on the type hint."""
        origin = get_origin(type_hint)
        args = get_args(type_hint)

        if origin is Union:
            # Handle Union types (e.g., Union[str, None] / Optional[str]).
            # Check the None sentinel BEFORE non-None args: for Optional[str],
            # str conversion never raises, so looping str-first permanently

View on GitHub (pinned to 6f998577d5)

Solutions

  1. Set EMBEDDING='openai:text-embedding-3-large' style value
  2. Verify provider is in the supported embedding providers list (openai, azure, ollama, huggingface, google_genai, ...)

Example fix

# before
EMBEDDING=text-embedding-3-large
# after
EMBEDDING=openai:text-embedding-3-large
Defensive patterns

Strategy: validation

Validate before calling

v = os.getenv("EMBEDDING", "")
assert ":" in v, "EMBEDDING must be 'provider:model'"

Try / catch

try:
    cfg = Config()
except ValueError as e:
    if "EMBEDDING" in str(e):
        raise SystemExit("Set EMBEDDING='openai:text-embedding-3-large'")
    raise

Prevention

When it happens

Trigger: Setting EMBEDDING='text-embedding-3-large' without the 'openai:' prefix, using '=' as separator, or leaving the value malformed.

Common situations: Newer config syntax migration; copy-paste from docs that show only the model part; quoting problems in .env.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28). Data as JSON: /api/errors/72bcc41307857f86. Report an issue: GitHub.