infiniflow/ragflow · error · SandboxProviderConfigError

Invalid Tenki provider configuration.

Error message

Invalid Tenki provider configuration.

What it means

Raised by TenkiProvider.initialize() when validate_config() rejects the merged provider config. The config dict (api_key, timeout, max_lifetime, max_output_bytes, max_artifacts, max_artifact_bytes) failed one of the base provider's validation rules, so the provider refuses to start and stays uninitialized.

Source

Thrown at agent/sandbox/providers/tenki.py:114

        self.cpu_cores = int(config.get("cpu_cores", 0) or 0)
        self.memory_mb = int(config.get("memory_mb", 0) or 0)
        self.disk_size_gb = int(config.get("disk_size_gb", 0) or 0)
        self.max_output_bytes = int(config.get("max_output_bytes", 1024 * 1024) or 1024 * 1024)
        self.max_artifacts = int(config.get("max_artifacts", 20) or 20)
        self.max_artifact_bytes = int(config.get("max_artifact_bytes", 10 * 1024 * 1024) or 10 * 1024 * 1024)

        is_valid, error_message = self.validate_config(
            {
                "api_key": self.api_key,
                "timeout": self.timeout,
                "max_lifetime": self.max_lifetime,
                "max_output_bytes": self.max_output_bytes,
                "max_artifacts": self.max_artifacts,
                "max_artifact_bytes": self.max_artifact_bytes,
            }
        )
        if not is_valid:
            raise SandboxProviderConfigError(error_message or "Invalid Tenki provider configuration.")

        self._client = self._create_client()
        self._assert_connectivity()

        self._initialized = True
        logger.info("Tenki provider initialized")
        return True

    def create_instance(self, template: str = "python") -> SandboxInstance:
        if not self._initialized:
            raise RuntimeError("Provider not initialized. Call initialize() first.")

        language = self._normalize_language(template)
        errors = self._tenki_errors()

        create_kwargs: dict[str, Any] = {
            "allow_outbound": self.allow_outbound,
            "max_duration": self.max_lifetime,

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Ensure config contains a non-empty api_key and positive integers for timeout, max_lifetime, max_output_bytes, max_artifacts, max_artifact_bytes.
  2. Log the error_message returned by validate_config() before it is swallowed; the specific reason is in the raised exception's message when provided.
  3. Check the key names exactly: api_key, base_url, image, allow_outbound, timeout, max_lifetime, cpu_cores, memory_mb, disk_size_gb, max_output_bytes, max_artifacts, max_artifact_bytes.

Example fix

# before
provider.initialize({"api_key": "", "timeout": 30})

# after
provider.initialize({"api_key": os.environ["TENKI_API_KEY"], "timeout": 30, "max_output_bytes": 1048576})
Defensive patterns

Strategy: validation

Validate before calling

def valid_tenki_config(cfg: dict) -> bool:
    return (
        bool(str(cfg.get("api_key", "")).strip())
        and int(cfg.get("timeout", 30)) > 0
        and int(cfg.get("max_lifetime", 3600)) > 0
        and int(cfg.get("max_output_bytes", 1048576)) > 0
        and int(cfg.get("max_artifacts", 20)) > 0
        and int(cfg.get("max_artifact_bytes", 10485760)) > 0
    )

if not valid_tenki_config(config):
    raise ValueError("tenki config invalid before initialize()")

Try / catch

try:
    provider.initialize(config)
except SandboxProviderConfigError as exc:
    logger.error("tenki config rejected: %s", exc)
    raise SystemExit(1) from exc

Prevention

When it happens

Trigger: Calling provider.initialize(config) with an empty or whitespace api_key, a timeout/max_lifetime of zero or negative, or non-positive byte/artifact caps (e.g. max_output_bytes=0). The fallback message 'Invalid Tenki provider configuration.' appears only when validate_config returns a falsy error_message.

Common situations: Sandbox config passed from agent settings with a missing TENKI api_key, copying config keys with wrong names (e.g. 'apikey' instead of 'api_key'), or passing string values like '-1' that int()-coerce into invalid numbers.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/076658c7fd8114c0. Report an issue: GitHub.