Skip to content
Latchkey

TinyGo "package ... is not supported" on the wasm target in CI

TinyGo implements a subset of Go and its standard library. Building for wasm or wasi can fail when code imports a package (reflection-heavy, networking, or os features) that TinyGo does not support on that target.

What this error means

A tinygo build -target wasm step fails with an error that a package or symbol is unsupported, or "interp: ..." / "could not compile" referencing a stdlib import.

tinygo
# command-line-arguments
tinygo: error: could not compile: package "net/http" is not supported on target wasm

Common causes

An unsupported stdlib package for wasm

Packages that need full OS, networking, or heavy reflection are not implemented in TinyGo for the wasm target, so importing them fails the build.

A feature gated to the host target only

Code that works for a native TinyGo build uses a feature absent on wasm/wasi, surfacing only when you switch the target.

How to fix it

Avoid the unsupported package on wasm

  1. Identify the package TinyGo names as unsupported.
  2. Replace it with a wasm-compatible alternative or host imports.
  3. Gate host-only code behind build tags so the wasm build excludes it.
native.go
//go:build !wasm

package app
// host-only code here

Target wasi if you need more system features

The wasi target supports more of the standard library than wasm; switch targets if your code needs file or environment access.

Terminal
tinygo build -o app.wasm -target=wasi ./...

How to prevent it

  • Use only TinyGo-supported packages on the wasm target.
  • Gate host-only code with build tags.
  • Pick wasi over wasm when you need more stdlib coverage.

Frequently asked questions

What causes "TinyGo "package not supported""?
Packages that need full OS, networking, or heavy reflection are not implemented in TinyGo for the wasm target, so importing them fails the build.
How do I fix TinyGo "package not supported"?
Avoid the unsupported package on wasm

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card