Skip to content
Latchkey

Deno "Import assertion type not supported" in CI

Deno rejected an import assertion because the syntax or type is not supported by the Deno version on the runner. Import assertion syntax moved to import attributes (with), so an older or mismatched runtime can fail.

What this error means

The run fails with "error: Import assertion type \"json\" not supported" or a parse error on assert { type: "json" } / with { type: "json" }.

deno
error: Import assertion type "json" not supported
    at file:///home/runner/work/app/app/src/config.ts:1:30

Common causes

A Deno version mismatch between local and CI

The syntax works on your local Deno but the CI runner has a different version that expects the other spelling (assert vs with).

Using the deprecated assert keyword

Newer Deno expects import attributes with with { type: "json" }; the older assert { type: "json" } may not be accepted.

How to fix it

Use import attributes with the with keyword

  1. Update the import to the attribute syntax supported by your Deno version.
  2. Re-run to confirm the assertion is accepted.
src/config.ts
import config from "./config.json" with { type: "json" };

Pin the Deno version in CI

Match the runner Deno to the version that supports your syntax so local and CI agree.

.github/workflows/ci.yml
- uses: denoland/setup-deno@v2
  with:
    deno-version: v2.x

How to prevent it

  • Standardize on the import attributes with syntax.
  • Pin the Deno version in CI to match local development.
  • Run deno --version in CI to log the exact runtime.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →