gohugoio/hugo · error

unsupported drop type

Error message

unsupported drop type: %q

What it means

Thrown when Drop is not console or debugger. These are the only markers esbuild can drop during a build.

Solutions

  1. Use: console or debugger.

Example fix

// before
{{ $opts := dict "drop" "logs" }}

// after
{{ $opts := dict "drop" "console" }}
Defensive patterns

Strategy: validation

Validate before calling

switch opts.Drop {
case "", "console", "debugger":
    // ok
default:
    return fmt.Errorf("unsupported drop type: %q", opts.Drop)
}

Prevention

When it happens

Trigger: Setting Drop to logs, comments, or any other string.

Common situations: User assumes more granular drop options exist (Webpack/swc terminology).

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/c9c66d8977a8d326. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/esbuild/options.go:400

	default:
		err = fmt.Errorf("unsupported platform type: %q", opts.Platform)
		return
	}

	var defines map[string]string
	if opts.Defines != nil {
		defines = hmaps.ToStringMapString(opts.Defines)
	}

	var drop api.Drop
	switch opts.Drop {
	case "":
	case "console":
		drop = api.DropConsole
	case "debugger":
		drop = api.DropDebugger
	default:
		err = fmt.Errorf("unsupported drop type: %q", opts.Drop)
	}

	// By default we only need to specify outDir and no outFile
	outDir := opts.OutDir
	outFile := ""
	var sourceMap api.SourceMap
	switch opts.SourceMap {
	case "inline":
		sourceMap = api.SourceMapInline
	case "external":
		sourceMap = api.SourceMapExternal
	case "linked":
		sourceMap = api.SourceMapLinked
	case "", "none":
		sourceMap = api.SourceMapNone
	default:
		err = fmt.Errorf("unsupported sourcemap type: %q", opts.SourceMap)
		return

View on GitHub (pinned to 52c9bd7908)