zylon-ai/private-gpt · error · ValueError

We don't have any result

Error message

We don't have any result

What it means

Raised in _chat_with_sandbox when self._pandas_ai.chat(...) returns a falsy result (None, empty). The sandbox is started/stopped around the call in try/finally, so this fires after a chat call that completed without raising but produced nothing — typically the pipeline short-circuited (no code generated, filtering rejected the output, or the underlying library returned None).

Solutions

  1. Enable debug logging for the pandasai layer to see why chat returned nothing (code generation step is usual culprit).
  2. Verify smart_dataframes are non-empty and schemas are attached before calling chat.
  3. Check the pandasai LLM configuration (key, model) — silent auth failures often end in None.
  4. Retry once; transient LLM failures can yield empty results.
  5. Treat as a user-facing 'analysis produced no result' case rather than crashing.

Example fix

# before
result = self._pandas_ai.chat(query, *smart_dataframes, sandbox=sandbox)
if not result:
    raise ValueError("We don't have any result")

# after (retry once, then degrade gracefully)
result = self._pandas_ai.chat(query, *smart_dataframes, sandbox=sandbox)
if not result:
    logger.warning("Empty analysis result, retrying once")
    result = self._pandas_ai.chat(query, *smart_dataframes, sandbox=sandbox)
if not result:
    raise ValueError("We don't have any result")
Defensive patterns

Strategy: retry

Validate before calling

def inputs_valid(query: str, dfs: list) -> bool:
    return bool(query.strip()) and all(df is not None for df in dfs)

Try / catch

try:
    result = service._chat_with_sandbox(query, dfs, sandbox)
except ValueError as e:
    if "We don't have any result" in str(e):
        result = service._chat_with_sandbox(query, dfs, sandbox)  # one retry
    else:
        raise

Prevention

When it happens

Trigger: pandasai chat returns None because code generation or execution was skipped/rejected internally; an empty conversation context or missing smart_dataframes causes an early None return; version of pandasai whose chat returns Optional[BaseResponse].

Common situations: Misconfigured LLM for pandasai silently failing; empty or malformed train dataframes; prompts the pipeline's safety filters block; API changes in the pandasai version returning a different response shape.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/6d7179421c4e122f. Report an issue: GitHub.

Appendix: source

Thrown at private_gpt/components/tabular/pandasai_service.py:297

        if session is None:
            return None

        return PandasAISandboxAdapter(client=session)

    def _execute_chat(
        self,
        query: str,
        smart_dataframes: list[DataFrame | VirtualDataFrame],
        sandbox: Sandbox | None,
    ) -> BaseResponse:
        """Execute the PandasAI chat call, managing sandbox lifecycle if needed."""
        try:
            if sandbox is not None:
                sandbox.start()

            result = self._pandas_ai.chat(query, *smart_dataframes, sandbox=sandbox)
            if not result:
                raise ValueError("We don't have any result")
            return result
        finally:
            if sandbox is not None:
                sandbox.stop()

    def _run_analysis_sync(
        self,
        query: str,
        smart_dataframes: list[DataFrame | VirtualDataFrame],
        sandbox: Sandbox | None,
    ) -> PandasAIOutput:
        """Synchronous analysis execution with sandbox management."""
        try:
            result = self._execute_chat(query, smart_dataframes, sandbox)
        except Exception as e:
            logger.error(f"Error during PandasAI analysis: {e}")
            result = ErrorResponse(error=str(e))

View on GitHub (pinned to 4a030776a3)