deepseek-ai/deepseek-harness · error · TypeError

pass either DeepSeekHarnessConfig or keyword options, not…

Error message

pass either DeepSeekHarnessConfig or keyword options, not both

What it means

DeepSeekHarness.__init__ guard: the caller supplied both a DeepSeekHarnessConfig positional and keyword options, which would leave precedence ambiguous. Construction is refused before any subprocess starts.

Solutions

  1. Pass either a DeepSeekHarnessConfig instance or keyword options to the constructor, not both.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at python/sdk/src/deepseek_harness/api.py:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/3f9233e28d1f8224. Report an issue: GitHub.

Appendix: source

Thrown at python/sdk/src/deepseek_harness/api.py:58

    session_id: str
    final_response: str
    finish_reason: str | None
    events: list[JsonObject]
    notifications: list[Notification]
    session_root: str | None = None


class DeepSeekHarness:
    """Reusable synchronous SDK for running DeepSeek Harness agent turns.

    The runtime subprocess starts lazily and remains owned by this instance
    across calls to :meth:`run`. Use the instance as a context manager, or call
    :meth:`close` explicitly when finished, so the subprocess is always reaped.
    """

    def __init__(self, config: DeepSeekHarnessConfig | None = None, **kwargs: object) -> None:
        if config is not None and kwargs:
            raise TypeError("pass either DeepSeekHarnessConfig or keyword options, not both")
        self.config = config or DeepSeekHarnessConfig(**kwargs)
        cwd = str(Path(self.config.cwd or Path.cwd()).resolve())
        runtime_cwd = str(Path(self.config.runtime_cwd).resolve()) if self.config.runtime_cwd is not None else cwd
        self._cwd = cwd
        env = dict(self.config.env)
        if self.config.session_root is not None:
            env["DSH_SESSION_ROOT"] = self.config.session_root
        if self.config.cordis is not None:
            env["DSH_CORDIS_CONFIG"] = self.config.cordis
        env["DSH_CWD"] = cwd
        if self.config.base_url is not None:
            env["DEEPSEEK_BASE_URL"] = self.config.base_url
        if self.config.api_key is not None:
            env["DEEPSEEK_API_KEY"] = self.config.api_key

        self._client = HarnessClient(
            HarnessConfig(
                runtime_bin=self.config.runtime_bin,

View on GitHub (pinned to b150a551b8)