deepseek-ai/deepseek-harness · error · WebError

WEB_UNSUPPORTED_CONTENT_TYPE

WEB_UNSUPPORTED_CONTENT_TYPE

Error message

unsupported charset "${charset}"

What it means

`decoderForCharset` could not construct a `TextDecoder` for the charset label the response declared, throwing `WEB_UNSUPPORTED_CONTENT_TYPE`. Failing loudly is deliberate: decoding with a wrong encoding would return mojibake; no declared charset falls back to UTF-8 instead.

Solutions

  1. Request a supported charset, or add support for the charset to the policy.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/web/web-fetch-http/src/policy.ts:103 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/00d468ae14f0d49e. Report an issue: GitHub.

Appendix: source

Thrown at packages/web/web-fetch-http/src/policy.ts:103

  return match?.[1]?.trim().toLowerCase()
}

/**
 * Build a `TextDecoder` for the declared charset, falling back to UTF-8 when
 * none is declared. Throws {@link WebError} `WEB_UNSUPPORTED_CONTENT_TYPE` when
 * the label is present but not a charset `TextDecoder` recognizes — better to
 * fail loudly than return mojibake.
 *
 * @param charset - the declared charset label (from {@link parseCharset}), or
 *   `undefined` to default to UTF-8.
 * @returns a decoder for the declared (or defaulted) encoding.
 */
export function decoderForCharset(charset: string | undefined): TextDecoder {
  if (charset === undefined) return new TextDecoder('utf-8')
  try {
    return new TextDecoder(charset)
  } catch (error: unknown) {
    throw new WebError(`unsupported charset "${charset}"`, 'WEB_UNSUPPORTED_CONTENT_TYPE', { cause: error })
  }
}

View on GitHub (pinned to b150a551b8)