davila7/claude-code-templates · warning

Warning: Error loading plugin permissions for ${plugin.name}

Error message

Warning: Error loading plugin permissions for ${plugin.name}

What it means

loadPluginPermissions loads a single plugin's permission settings file (plugin.name.json or equivalent under the plugin's config area) and warns when that read/parse or per-entry processing fails. The warning names the offending plugin, which is the key diagnostic. It returns whatever permission entries were parsed before the failure.

Source

Thrown at cli-tool/src/plugin-dashboard.js:533

          }
        }
      }

      // Load plugin MCPs
      const mcpFile = path.join(plugin.path, '.mcp.json');
      if (await fs.pathExists(mcpFile)) {
        const mcpData = JSON.parse(await fs.readFile(mcpFile, 'utf8'));
        for (const [name, config] of Object.entries(mcpData.mcpServers || {})) {
          permissions.mcps.push({
            name,
            source: 'Plugin',
            plugin: plugin.name,
            config
          });
        }
      }
    } catch (error) {
      console.warn(chalk.yellow(`Warning: Error loading plugin permissions for ${plugin.name}`), error.message);
    }

    return permissions;
  }

  setupWebServer() {
    // Add CORS middleware
    this.app.use((req, res, next) => {
      res.header('Access-Control-Allow-Origin', '*');
      res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
      res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');

      if (req.method === 'OPTIONS') {
        res.sendStatus(200);
        return;
      }

      next();

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Open the plugin's permissions/settings file named in the warning and validate it with `jq .`
  2. Fix or delete the corrupt file (it can be regenerated by re-enabling/reinstalling the plugin)
  3. Reinstall the plugin from its marketplace to restore pristine config
  4. Verify directory permissions with `ls -la` on the plugin's config path if parsing is fine

Example fix

// before
[ { "plugin": "my-plugin", "config": undefined } ]
// after
[ { "plugin": "my-plugin", "config": { "allowed": ["Bash(git:*)"] } } ]
Defensive patterns

Strategy: validation

Validate before calling

async function pluginPermFileOk(file) {
  if (!(await fs.pathExists(file))) return true;
  try {
    const arr = JSON.parse(await fs.readFile(file, 'utf8'));
    return Array.isArray(arr);
  } catch { return false; }
}

Type guard

function isPermissionEntry(e) {
  return e != null && typeof e === 'object' && typeof e.plugin === 'string' && e.config != null;
}

Try / catch

catch (error) {
  console.warn(`Permissions for ${plugin.name} unavailable: ${error.message}`);
  return permissions; // partial entries already collected
}

Prevention

When it happens

Trigger: Calling loadPluginPermissions for a plugin whose permissions/settings file is invalid JSON, contains permission entries with a shape other than the expected {plugin, config} records, or lives in an unreadable directory (permission bits, dangling symlink).

Common situations: A plugin's settings file corrupted during install/update; plugin author shipped a permissions file in an older format; leftover files from an uninstalled plugin whose directory was partially deleted.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/dbf75dfbad82aec6. Report an issue: GitHub.