{"record":{"id":"61d50db1cf960e5e","repo":"denoland/deno","slug":"object-is-not-a-valid-image-or-a-path-to-an-image","errorCode":null,"errorMessage":"Object is not a valid image or a path to an image. `Deno.jupyter.image` supports displaying JPG or PNG images, or GPUTextures.","messagePattern":"Object is not a valid image or a path to an image\\. `Deno\\.jupyter\\.image` supports displaying JPG or PNG images, or GPUTextures\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"cli/js/40_jupyter.js","lineNumber":413,"sourceCode":"  if (isJpg(obj)) {\n    return makeDisplayable({\n      \"image/jpeg\": core.ops.op_base64_encode_from_buffer(obj, 0, obj.length),\n    });\n  }\n\n  if (isPng(obj)) {\n    return makeDisplayable({\n      \"image/png\": core.ops.op_base64_encode_from_buffer(obj, 0, obj.length),\n    });\n  }\n\n  if (obj instanceof GPUTexture) {\n    return makeDisplayable({\n      \"image/png\": core.ops.op_jupyter_create_png_from_texture(obj),\n    });\n  }\n\n  throw new TypeError(\n    \"Object is not a valid image or a path to an image. `Deno.jupyter.image` supports displaying JPG or PNG images, or GPUTextures.\",\n  );\n}\n\nfunction isMediaBundle(obj) {\n  if (obj == null || typeof obj !== \"object\" || Array.isArray(obj)) {\n    return false;\n  }\n  for (const key in obj) {\n    if (typeof key !== \"string\") {\n      return false;\n    }\n  }\n  return true;\n}\n\nasync function formatInner(obj, raw) {\n  if (raw && isMediaBundle(obj)) {","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_jupyter.js#L395-L431","documentation":"The stock-tsc/tsgo compatibility layer (`npm_compat`) generates a root tsconfig that maps jsr:/npm:/http(s): dependencies onto local mirror files under `.deno/`. This is a thin wrapper: `{e}` carries the real cause from the underlying generation routine (filesystem errors writing `.deno/`, unresolvable member paths, mirror-path failures, etc.), so the appended inner error is the thing to read.","triggerScenarios":"`deno check`/`deno sync-types` with the stock TypeScript compatibility pipeline when tsconfig generation fails underneath: unwritable or corrupted `.deno` directory, a remote module URL that cannot be mirrored (directory-like URL), invalid member paths in the workspace, or disk-full conditions.","commonSituations":"Read-only project directory in CI containers; a previously interrupted run left a malformed `.deno` tree; imports of directory-style URLs (`https://example.com/lib/`) inside the dependency graph; disk quota exhaustion.","solutions":["Read the inner `{e}` cause — it names the actual failing operation","Clear the generated cache directory (`rm -rf .deno`) and re-run to regenerate from scratch","Ensure the project root is writable by the current user","If the cause points at a specific URL, fix that import (use concrete file URLs rather than directories)"],"exampleFix":"# before\n$ deno check main.ts\n# Failed to generate tsconfig: ... (inner cause)\n\n# after\n$ rm -rf .deno && deno check main.ts  # regenerated cleanly","handlingStrategy":"try-catch","validationCode":"# Cheap pre-flight: writable project root and no stale generated tree\n[ -w . ] || { echo 'project not writable'; exit 1; }\n[ ! -d .deno ] || rm -rf .deno  # regenerate cleanly","typeGuard":null,"tryCatchPattern":"When wrapping `deno check`/`deno sync-types` programmatically, capture stderr and split the message on ': ' — the tail after 'Failed to generate tsconfig:' is the real cause; branch on it (unwritable dir -> fix perms; specific URL -> fix the import) instead of retrying blindly.","preventionTips":["Keep .deno/ out of version control and delete it after interrupted runs","Ensure write permission on the project root in containers","Prefer concrete file imports so mirror-path generation never hits ambiguous URLs"],"tags":["typescript","tsconfig","npm-compat","code-generation"],"backgroundTag":"config-generation-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}