{"record":{"id":"4d9638f2430b4bb8","repo":"wailsapp/wails","slug":"it-s-not-possible-to-use-the-deprecated-assets-and","errorCode":null,"errorMessage":"It's not possible to use the deprecated Assets and AssetsHandler options and the new AssetServer option at the same time. Please migrate all your Assets options to the AssetServer option.","messagePattern":"It's not possible to use the deprecated Assets and AssetsHandler options and the new AssetServer option at the same time\\. Please migrate all your Assets options to the AssetServer option\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"v2/pkg/assetserver/common.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/wailsapp/wails/v2/pkg/options\"\n\t\"github.com/wailsapp/wails/v2/pkg/options/assetserver\"\n\t\"golang.org/x/net/html\"\n)\n\nfunc BuildAssetServerConfig(appOptions *options.App) (assetserver.Options, error) {\n\tvar options assetserver.Options\n\tif opt := appOptions.AssetServer; opt != nil {\n\t\tif appOptions.Assets != nil || appOptions.AssetsHandler != nil {\n\t\t\tpanic(\"It's not possible to use the deprecated Assets and AssetsHandler options and the new AssetServer option at the same time. Please migrate all your Assets options to the AssetServer option.\")\n\t\t}\n\n\t\toptions = *opt\n\t} else {\n\t\toptions = assetserver.Options{\n\t\t\tAssets:  appOptions.Assets,\n\t\t\tHandler: appOptions.AssetsHandler,\n\t\t}\n\t}\n\n\treturn options, options.Validate()\n}\n\nconst (\n\tHeaderHost          = \"Host\"\n\tHeaderContentType   = \"Content-Type\"\n\tHeaderContentLength = \"Content-Length\"\n\tHeaderUserAgent     = \"User-Agent\"","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v2/pkg/assetserver/common.go#L2-L38","documentation":"BuildAssetServerConfig panics when the app options set both the new AssetServer option and either of the deprecated Assets / AssetsHandler options. Wails v2 migrated asset configuration to the unified AssetServer option, and mixing the two is ambiguous, so startup aborts with an explicit migration message.","triggerScenarios":"Passing options.App{AssetServer: &assetserver.Options{...}} while also setting Assets (an embed.FS/http.FS) or AssetsHandler in the same options struct.","commonSituations":"Upgrading a v2 app that had Assets: assets embedded, then adding AssetServer for middleware/HookContext features without removing the old fields; merging config from samples that use different option styles.","solutions":["Move the embedded FS into AssetServer.Assets and any handler into AssetServer.Handler","Delete the deprecated Assets and AssetsHandler fields from the options.App literal","Rebuild and confirm the app serves assets"],"exampleFix":"// before\nerr := wails.Run(&options.App{\n    Assets:     assets,\n    AssetServer: &assetserver.Options{Assets: assets},\n})\n\n// after\nerr := wails.Run(&options.App{\n    AssetServer: &assetserver.Options{\n        Assets:  assets,\n        Handler: myHandler,\n    },\n})","handlingStrategy":"validation","validationCode":"// fail fast before wails.Run\nif appOpts.AssetServer != nil && (appOpts.Assets != nil || appOpts.AssetsHandler != nil) {\n    log.Fatal(\"remove deprecated Assets/AssetsHandler; use AssetServer only\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After adding AssetServer to options, grep the options literal for Assets: and AssetsHandler:","Follow the v2 migration notes when adopting AssetServer features (middleware, HookContext)"],"tags":["config","assetserver","migration","v2","startup"],"backgroundTag":null,"analyzedSha":"0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3","analyzedAt":"2026-08-15T14:17:36.034Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}