tauri-apps/tauri · error

cannot use both `resources` and `resources_map`

Error message

cannot use both `resources` and `resources_map`

What it means

Panic in tauri-bundler's Settings::resource_files(). The bundle configuration accepts resources either as a list/string (resources) or as a mapping of source->target (resourcesMap), and both being set at once is rejected with this panic before any bundling starts.

Source

Thrown at crates/tauri-bundler/src/bundle/settings.rs:1183

  /// Returns an iterator over the icon files to be used for this bundle.
  pub fn icon_files(&self) -> ResourcePaths<'_> {
    match self.icon_files {
      Some(ref paths) => ResourcePaths::new(paths.as_slice(), false),
      None => ResourcePaths::new(&[], false),
    }
  }

  /// Returns an iterator over the resource files to be included in this
  /// bundle.
  pub fn resource_files(&self) -> ResourcePaths<'_> {
    match (
      &self.bundle_settings.resources,
      &self.bundle_settings.resources_map,
    ) {
      (Some(paths), None) => ResourcePaths::new(paths.as_slice(), true),
      (None, Some(map)) => ResourcePaths::from_map(map, true),
      (Some(_), Some(_)) => panic!("cannot use both `resources` and `resources_map`"),
      (None, None) => ResourcePaths::new(&[], true),
    }
  }

  /// Returns an iterator over the external binaries to be included in this
  /// bundle.
  pub fn external_binaries(&self) -> ResourcePaths<'_> {
    match self.bundle_settings.external_bin {
      Some(ref paths) => ResourcePaths::new(paths.as_slice(), true),
      None => ResourcePaths::new(&[], true),
    }
  }

  /// Copies external binaries to a path.
  ///
  /// Returns the list of destination paths.
  pub fn copy_binaries(&self, path: &Path) -> crate::Result<Vec<PathBuf>> {
    let mut paths = Vec::new();

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Keep exactly one form in tauri.conf.json: delete `resources` or delete `resourcesMap`
  2. If you need per-file target paths, convert the whole list into map entries, e.g. "resourcesMap": { "assets/logo.svg": "icons/logo.svg" }
  3. Check platform-specific config overlays for the duplicated key before rebuilding

Example fix

// before (tauri.conf.json)
"bundle": { "resources": ["assets/*"], "resourcesMap": { "assets/a.png": "a.png" } }

// after
"bundle": { "resourcesMap": { "assets/*": "/" } }  // or keep only "resources": ["assets/*"]
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from 'node:fs';
const cfg = JSON.parse(readFileSync('src-tauri/tauri.conf.json', 'utf8'));
const { resources, resourcesMap } = cfg.bundle ?? {};
if (resources && resourcesMap) {
  throw new Error('bundle.resources and bundle.resourcesMap are mutually exclusive');
}

Prevention

When it happens

Trigger: A tauri.conf.json (or platform-specific config merged on top) that contains both `bundle.resources` and `bundle.resourcesMap` keys after config merging.

Common situations: Migrating from the array syntax to the map syntax and forgetting to delete the old key; platform-specific config overlays (tauri.macos.conf.json) adding resourcesMap on top of a base with resources.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/10f870e114ab9f08. Report an issue: GitHub.