sgl-project/sglang · error · Error

Unsupported content type ${header.content_type}

Error message

Unsupported content type ${header.content_type}

What it means

The mesh_processor diffusion op meshVerticeInpaint only supports method == "smooth"; any other string for the `method` argument raises std::invalid_argument. The dispatch is a simple if/else with a single implemented backend.

Source

Thrown at python/sglang/multimodal_gen/apps/realtime_webui/app.js:1108

  return restored;
}

async function framePayloadToImageData(header, payload) {
  let rawPayload;
  const isRgba = header.content_type === RAW_RGBA_DELTA_GZIP_CONTENT_TYPE;
  if (
    header.content_type === WEBP_FRAME_CONTENT_TYPE ||
    header.content_type === JPEG_FRAME_CONTENT_TYPE
  ) {
    return encodedImageToImageData(header, payload);
  } else if (header.content_type === RAW_RGB_CONTENT_TYPE) {
    rawPayload = payload instanceof Uint8Array ? payload : new Uint8Array(payload);
  } else if (header.content_type === RAW_RGB_DELTA_GZIP_CONTENT_TYPE) {
    rawPayload = await restoreDeltaGzipRawRgb(header, payload);
  } else if (isRgba) {
    rawPayload = await restoreDeltaGzipRawRgb(header, payload);
  } else {
    throw new Error(`Unsupported content type ${header.content_type}`);
  }
  const frameBytes = Number(header.bytes_per_frame);
  const frameCount = Number(header.num_frames);
  if (frameCount > 0) {
    const offset = (frameCount - 1) * frameBytes;
    lastRawRgbFrame = rawPayload.slice(offset, offset + frameBytes);
  }
  if (isRgba) {
    return rgbaToImageData(header, rawPayload);
  }
  return rgbToImageData(header, rawPayload);
}

function isEncodedPreviewContentType(contentType) {
  return (
    contentType === WEBP_FRAME_CONTENT_TYPE ||
    contentType === JPEG_FRAME_CONTENT_TYPE
  );

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass method="smooth" (exact lowercase) or omit it — it's the default argument
  2. Remove method-selection logic until additional backends are implemented in mesh_processor.cpp
  3. Check the extension source (or its pybind docstring) for newly added methods in newer builds

Example fix

# before
out = mesh_processor.meshVerticeInpaint(tex, mask, pos, uv, pi, ui, method="telea")

# after
out = mesh_processor.meshVerticeInpaint(tex, mask, pos, uv, pi, ui, method="smooth")
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {"smooth"}
method = method if method in ALLOWED else "smooth"  # or raise early
mesh_processor.meshVerticeInpaint(tex, mask, pos, uv, pi, ui, method=method)

Type guard

def is_supported_method(m: str) -> bool:
    return m == "smooth"

Try / catch

try:
    mesh_processor.meshVerticeInpaint(..., method=method)
except ValueError as e:
    if "Invalid method" in str(e):
        method = "smooth"
        mesh_processor.meshVerticeInpaint(..., method=method)
    else:
        raise

Prevention

When it happens

Trigger: Calling meshVerticeInpaint(texture, mask, vtx_pos, vtx_uv, pos_idx, uv_idx, method) with method set to anything other than 'smooth' — e.g. 'poisson', 'telea', 'inpaint', or a typo like 'Smooth'.

Common situations: Porting code from OpenCV's inpaint (which accepts INPAINT_TELEA/NS) and assuming similar method names, case mismatches, or passing a default from another library's API.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/e8a19c39f01abe50. Report an issue: GitHub.