{"record":{"id":"10f870e114ab9f08","repo":"tauri-apps/tauri","slug":"cannot-use-both-resources-and-resources-map","errorCode":null,"errorMessage":"cannot use both `resources` and `resources_map`","messagePattern":"cannot use both `resources` and `resources_map`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tauri-bundler/src/bundle/settings.rs","lineNumber":1183,"sourceCode":"\n  /// Returns an iterator over the icon files to be used for this bundle.\n  pub fn icon_files(&self) -> ResourcePaths<'_> {\n    match self.icon_files {\n      Some(ref paths) => ResourcePaths::new(paths.as_slice(), false),\n      None => ResourcePaths::new(&[], false),\n    }\n  }\n\n  /// Returns an iterator over the resource files to be included in this\n  /// bundle.\n  pub fn resource_files(&self) -> ResourcePaths<'_> {\n    match (\n      &self.bundle_settings.resources,\n      &self.bundle_settings.resources_map,\n    ) {\n      (Some(paths), None) => ResourcePaths::new(paths.as_slice(), true),\n      (None, Some(map)) => ResourcePaths::from_map(map, true),\n      (Some(_), Some(_)) => panic!(\"cannot use both `resources` and `resources_map`\"),\n      (None, None) => ResourcePaths::new(&[], true),\n    }\n  }\n\n  /// Returns an iterator over the external binaries to be included in this\n  /// bundle.\n  pub fn external_binaries(&self) -> ResourcePaths<'_> {\n    match self.bundle_settings.external_bin {\n      Some(ref paths) => ResourcePaths::new(paths.as_slice(), true),\n      None => ResourcePaths::new(&[], true),\n    }\n  }\n\n  /// Copies external binaries to a path.\n  ///\n  /// Returns the list of destination paths.\n  pub fn copy_binaries(&self, path: &Path) -> crate::Result<Vec<PathBuf>> {\n    let mut paths = Vec::new();","sourceCodeStart":1165,"sourceCodeEnd":1201,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/settings.rs#L1165-L1201","documentation":"The bundler's resource gathering accepts resources either as a plain list (resources) or as a map from source to target (resources_map), but not both. BundleSettings::resources() panics when both fields are set in the Tauri configuration.","triggerScenarios":"tauri.conf.json's bundle section defines both bundle.resources and bundle.resources_map at the same time, so the (Some, Some) match arm triggers the panic.","commonSituations":"Merging config fragments (e.g. platform-specific conf JSON or a merge tool) where each side adds one of the two keys; migrating to resources_map without removing the old resources array.","solutions":["Remove either bundle.resources or bundle.resources_map from tauri.conf.json so only one remains","If merging configs, exclude the conflicting key in the platform-specific fragment","Convert the list entries into map entries if you need per-file target paths"],"exampleFix":"// before (tauri.conf.json)\n\"resources\": [\"assets/*\"], \"resources_map\": {\"a.txt\": \"b.txt\"}\n// after\n\"resources_map\": {\"assets/*\": \"assets/\", \"a.txt\": \"b.txt\"}","handlingStrategy":"validation","validationCode":"const conf = JSON.parse(readFileSync('tauri.conf.json', 'utf8'));\nif (conf.bundle?.resources && conf.bundle?.resources_map)\n  throw new Error('Set either bundle.resources or bundle.resources_map, not both');","typeGuard":"function hasConflictingResources(b?: { resources?: unknown; resources_map?: unknown }): boolean {\n  return b != null && b.resources != null && b.resources_map != null;\n}","tryCatchPattern":null,"preventionTips":["Lint tauri.conf.json in CI for mutually exclusive bundle keys","When merging platform-specific configs, delete overridden keys instead of adding siblings","Migrate wholesale to resources_map and keep resources only for legacy paths"],"tags":["tauri","bundler","configuration","panic"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}