{"record":{"id":"5fefb45cd4dd3988","repo":"gohugoio/hugo","slug":"invalid-engine-version-q","errorCode":null,"errorMessage":"invalid engine version: %q","messagePattern":"invalid engine version: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/options.go","lineNumber":287,"sourceCode":"func (opts *Options) compile() (err error) {\n\tvar target api.Target\n\tfor _, value := range opts.Target {\n\t\tif v, found := nameTarget[value]; found {\n\t\t\tif v > target {\n\t\t\t\ttarget = v\n\t\t\t}\n\t\t}\n\t}\n\n\tvar engines []api.Engine\n\nOUTER:\n\tfor _, value := range opts.Target {\n\t\tfor _, engine := range engineKeysSorted {\n\t\t\tif strings.HasPrefix(value, engine) {\n\t\t\t\tversion := value[len(engine):]\n\t\t\t\tif version == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"invalid engine version: %q\", value)\n\t\t\t\t}\n\t\t\t\tengines = append(engines, api.Engine{Name: engineName[engine], Version: version})\n\t\t\t\tcontinue OUTER\n\t\t\t}\n\t\t}\n\t}\n\n\tif target == 0 && len(engines) == 0 && len(opts.Target) > 0 {\n\t\treturn fmt.Errorf(\"unsupported target: %v\", opts.Target)\n\t}\n\n\tif target == 0 {\n\t\ttarget = api.ESNext\n\t}\n\n\tvar loaders map[string]api.Loader\n\tif opts.IsCSS {\n\t\tloaders = make(map[string]api.Loader)","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/internal/js/esbuild/options.go#L269-L305","documentation":"Thrown during option compilation when a Target value matches a known engine name prefix (chrome, firefox, safari, node, etc.) but has no version suffix appended. Engine targets require a version, e.g. chrome80.","triggerScenarios":"Setting Target to [\"chrome\"] or [\"safari\"] (no version). The loop at options.go:282-293 strips the matched engine prefix and finds the remainder empty, triggering the error.","commonSituations":"User thinks a bare engine name is a valid target; trailing whitespace was stripped accidentally; copy-paste from docs that elided the version number.","solutions":["Append a numeric version: chrome80, firefox73, safari13, etc.","If you only want a JS language version, use es2020, esnext, etc. instead of an engine name."],"exampleFix":"// before\n{{ $opts := dict \"targets\" (slice \"chrome\") }}\n\n// after\n{{ $opts := dict \"targets\" (slice \"chrome80\") }}","handlingStrategy":"validation","validationCode":"engineRe := regexp.MustCompile(`^(chrome|deno|edge|firefox|hermes|ie|ios|node|opera|rhino|safari)\\d+$`)\nfor _, t := range opts.Target {\n    if _, ok := nameTarget[t]; ok { continue }\n    if engineRe.MatchString(t) { continue }\n    if strings.HasPrefix(t, \"chrome\") || strings.HasPrefix(t, \"safari\") /* ... */ {\n        return fmt.Errorf(\"engine target needs a version number: %q\", t)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Target strings before Build.","Document that engine names require a numeric version suffix.","Prefer ES language versions (es2020) unless you specifically need engine targeting."],"tags":["esbuild","options","target","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}