dsh-request-error-dump: A Tool for Dumping Model Request Errors to Disk

Preface

When handling failed model requests, DeepSeek Harness (DSH) typically normalizes errors, for example displaying “Run failed in this turn” on the UI. For developers, the specific upstream error details such as 401, 403, 429, or 400 are often hidden behind this brief message. When debugging issues like invalid keys, rate limits, or malformed request bodies, the lack of raw payloads makes troubleshooting difficult.

dsh-request-error-dump is a DSH plugin designed to address this problem. When a model request fails, it writes the complete raw request body and the upstream error response body to local files, preserving full contextual information.

Core Features

The plugin focuses on capturing failure scenarios during model inference. The recorded content consists of four sections:

  1. Request (request): Records the URL, HTTP method, request headers (with optional redaction), raw request body (body.raw), and a parsed view (body.json).
  2. Response (response): Records the status code, status message, response headers, and the raw upstream response body (body.raw) along with a parsed view.
  3. Transport Error (transportError): Records network-level exceptions such as DNS resolution failures, TLS handshake errors, and connection timeouts.
  4. DSH Context (dsh): Records the current turn (turn), step (step), provider (provider), failure reason (failure), and correlation ID (correlation).

Additionally, the plugin supports configuring bodyFormat (raw only / parsed only / both) and redactHeaders (specifying request header names to redact). It defaults to zero-configuration mode, capturing only model requests.

Installation and Activation

This plugin has no runtime dependencies. A DSH restart is required after installation for the configuration to take effect.

# Install from GitHub
dsh plugin --profile desktop add github:exynos967/dsh-request-error-dump

After installation, failed request logs are saved to the ~/.dsh/request-error-dump/ directory by default.

Configuration

All configuration options have default values and the plugin works out of the box without any configuration. To adjust settings, override them in the profile’s cordis.patch.yml:

- id: request-error-dump
  config:
    outDir: ~/.dsh/request-error-dump      # Output directory
    maxFiles: 50                           # Number of latest files to keep; 0 means no cleanup
    maxCaptureBytes: 0                     # Maximum size per file (bytes); 0 means no truncation
    bodyFormat: both                        # raw / parsed / both
    redactHeaders: ['authorization', 'api-key', 'cookie']  # List of headers to redact
    flushDelayMs: 1500                     # Delay in milliseconds to wait for context enrichment
    ignoreAborted: true                     # Do not record on user cancellation
    modelRequestsOnly: true                 # Whether to capture only model requests
    excludeUrls: ['/user/balance']          # List of URLs to exclude (regex matching)
    log: true                               # Whether to log file write notifications

Key Parameters:
* maxCaptureBytes: Defaults to 0, meaning the request body is not truncated. When truncated, the json view will be marked with truncated: true.
* redactHeaders: Defaults to redacting common credential headers such as authorization and api-key. Setting it to [] disables redaction (with potential privacy risks).
* flushDelayMs: Defaults to 1500ms. The plugin waits for the agent/request-error event to enrich DSH-side contextual information. Setting it to 0 writes immediately.
* excludeUrls: Excludes /user/balance by default to prevent log spam caused by polling from the desktop balance widget.

Detection and Privacy

The plugin determines whether a request is a “model request” using two signals:
1. Authoritative signal: Claimed by the agent/request-error event dispatched by the DSH loop.
2. Fallback signal: The request structure matches model invocation characteristics (POST with a JSON body containing model or modelId fields, or matches specific path patterns).

Privacy Boundaries: Since request bodies typically contain system prompts, source code, tool results, and even secrets, the plugin only redacts credentials in request headers by default and saves the body content verbatim. Do not enable this plugin in untrusted environments or shared directories.

Honest Limitations

The plugin is not perfect and has the following limitations:
* Detection Accuracy: Not 100% precise. In extreme cases (custom gateways without model fields), some requests may be missed.
* Capture Scope: Does not capture failures mid-stream, nor FormData/Blob/ReadableStream request bodies (reading consumes them).
* Pre-Request Errors: Does not capture errors that occur before the request is sent (such as unconfigured keys or routes with no adapter).
* No Modification Capability: Pure observer mode; does not retry, inject, or modify requests.

Conclusion

dsh-request-error-dump fills the gap between DSH’s standard error handling and developers’ debugging needs by intercepting the HTTP request layer. With zero runtime dependencies and a transparent mechanism, it helps developers quickly pinpoint the root causes of model invocation failures.

Plugin Directory | GitHub Repository

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye