denoland/deno · error · TypeError

Object is not a valid image or a path to an image. `Deno.jup

Error message

Object is not a valid image or a path to an image. `Deno.jupyter.image` supports displaying JPG or PNG images, or GPUTextures.

What it means

The downloaded, checksum-verified cache directory for the backend does not contain the expected backend binary — the archive's internal layout does not match what the binary locator expects for that backend/target.

Source

Thrown at cli/js/40_jupyter.js:413

  if (isJpg(obj)) {
    return makeDisplayable({
      "image/jpeg": core.ops.op_base64_encode_from_buffer(obj, 0, obj.length),
    });
  }

  if (isPng(obj)) {
    return makeDisplayable({
      "image/png": core.ops.op_base64_encode_from_buffer(obj, 0, obj.length),
    });
  }

  if (obj instanceof GPUTexture) {
    return makeDisplayable({
      "image/png": core.ops.op_jupyter_create_png_from_texture(obj),
    });
  }

  throw new TypeError(
    "Object is not a valid image or a path to an image. `Deno.jupyter.image` supports displaying JPG or PNG images, or GPUTextures.",
  );
}

function isMediaBundle(obj) {
  if (obj == null || typeof obj !== "object" || Array.isArray(obj)) {
    return false;
  }
  for (const key in obj) {
    if (typeof key !== "string") {
      return false;
    }
  }
  return true;
}

async function formatInner(obj, raw) {
  if (raw && isMediaBundle(obj)) {

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Delete the cached laufey directory for that backend/target and re-run to force a clean re-download
  2. Update Deno to a version matching the current laufey release layout
  3. If it persists on the latest version, report a bug including backend, target, and Deno version
Defensive patterns

Strategy: validation

Validate before calling

const binary = join(laufeyCacheDir, backend, expectedBinaryName(target));
if (!await exists(binary)) {
  await Deno.remove(laufeyCacheDir, { recursive: true }).catch(() => {}); // force clean re-download
}

Prevention

When it happens

Trigger: Version skew: a laufey release changed its archive layout while this Deno build expects the previous one; or the cache directory was manually rearranged/truncated after extraction.

Common situations: Using an outdated Deno against a newer laufey release; users pruning or editing the cache by hand; partially deleted cache from a crashed run.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/61d50db1cf960e5e. Report an issue: GitHub.