davila7/claude-code-templates · warning

Warning: Error loading plugin ${pluginDir}

Error message

Warning: Error loading plugin ${pluginDir}

What it means

Inside loadInstalledPlugins(), each installed plugin's plugin.json is read and parsed; this per-plugin warning fires when one plugin's directory or plugin.json is unreadable/malformed while the rest keep loading. The outer list is preserved — only the offending plugin is skipped.

Source

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

              const pluginJson = JSON.parse(await fs.readFile(pluginJsonPath, 'utf8'));

              // Count components
              const components = await this.countPluginComponents(pluginPath);

              plugins.push({
                name: pluginJson.name,
                version: pluginJson.version || '1.0.0',
                description: pluginJson.description || 'No description',
                marketplace: marketplaceDir,
                path: pluginPath,
                components,
                author: pluginJson.author,
                homepage: pluginJson.homepage,
                license: pluginJson.license
              });
            }
          } catch (error) {
            console.warn(chalk.yellow(`Warning: Error loading plugin ${pluginDir}`), error.message);
          }
        }
      }

      return plugins;
    } catch (error) {
      console.warn(chalk.yellow('Warning: Error loading plugins'), error.message);
      return [];
    }
  }

  async loadPluginsFromMarketplace(marketplacePath, marketplaceName) {
    const plugins = [];

    try {
      const marketplaceJsonPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
      const content = await fs.readFile(marketplaceJsonPath, 'utf8');
      const marketplaceData = JSON.parse(content);

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Check ~/.claude/plugins/<pluginDir>/plugin.json exists and is valid JSON (`cat` it, or run it through a JSON validator).
  2. Delete or complete half-installed plugin folders.
  3. Reinstall the plugin from its marketplace to regenerate a valid manifest.
  4. Match required fields (name, version, description) as documented by the plugin schema.

Example fix

// before: plugin.json missing
{"name": "foo"}
// after: valid manifest at ~/.claude/plugins/foo/plugin.json
{
  "name": "foo",
  "version": "1.0.0",
  "description": "...",
  "author": "..."
}
Defensive patterns

Strategy: validation

Validate before calling

const manifest = path.join(pluginDir, 'plugin.json');
if (!fs.existsSync(manifest)) continue; // skip pluginless folder
const json = JSON.parse(fs.readFileSync(manifest, 'utf8'));

Type guard

const isPluginManifest = (v) => v != null && typeof v.name === 'string' && typeof v.version === 'string';

Try / catch

catch (e) { console.warn(`Skipping plugin ${pluginDir}:`, e.message); }

Prevention

When it happens

Trigger: A plugin directory in ~/.claude/plugins lacking plugin.json (ENOENT), a plugin.json with invalid JSON, or an unexpected schema (missing required fields causing downstream property access to throw) within the per-plugin try block.

Common situations: Manually copied plugin folders without a manifest, partially downloaded plugins, hand-edited plugin.json files with syntax errors, or plugins written for an older manifest schema.

Related errors


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