musistudio/claude-code-router · error

Invalid PNG file.

Error message

Invalid PNG file.

What it means

Error "Invalid PNG file." thrown in musistudio/claude-code-router.

Source

Thrown at packages/electron/src/main/ipc.ts:745

    }
    return image.resize({ height, width }).toPNG();
  } catch (error) {
    console.warn(`[export] Failed to resize exported PNG fallback: ${formatError(error)}`);
    return undefined;
  }
}

function sanitizePngOutputDimension(value: unknown): number | undefined {
  if (typeof value !== "number" || !Number.isFinite(value)) {
    return undefined;
  }
  const rounded = Math.round(value);
  return rounded > 0 && rounded <= 4096 ? rounded : undefined;
}

function decodePngPixels(png: Buffer): DecodedPngPixels {
  if (png.length < 33 || !png.subarray(0, pngSignature.length).equals(pngSignature)) {
    throw new Error("Invalid PNG file.");
  }

  let offset = pngSignature.length;
  let width = 0;
  let height = 0;
  let bitDepth = 0;
  let colorType = 0;
  let interlaceMethod = 0;
  const idatChunks: Buffer[] = [];

  while (offset + 12 <= png.length) {
    const length = png.readUInt32BE(offset);
    offset += 4;
    const type = png.toString("ascii", offset, offset + 4);
    offset += 4;
    const data = png.subarray(offset, offset + length);
    offset += length + 4;

View on GitHub (pinned to 99f24806c6)

When it happens

Trigger: Thrown at packages/electron/src/main/ipc.ts:745 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/a41dedd37e94fa1e. Report an issue: GitHub.