{"record":{"id":"d8ff2c2b78ce7ff0","repo":"davila7/claude-code-templates","slug":"warning-error-loading-user-permissions","errorCode":null,"errorMessage":"Warning: Error loading user permissions","messagePattern":"Warning: Error loading user permissions","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli-tool/src/plugin-dashboard.js","lineNumber":459,"sourceCode":"          }\n        }\n      }\n\n      // Load user-level MCPs\n      const userMcpFile = path.join(this.claudeDir, '.mcp.json');\n      if (await fs.pathExists(userMcpFile)) {\n        const mcpData = JSON.parse(await fs.readFile(userMcpFile, 'utf8'));\n        for (const [name, config] of Object.entries(mcpData.mcpServers || {})) {\n          permissions.mcps.push({\n            name,\n            source: 'User',\n            plugin: null,\n            config\n          });\n        }\n      }\n    } catch (error) {\n      console.warn(chalk.yellow('Warning: Error loading user permissions'), error.message);\n    }\n\n    return permissions;\n  }\n\n  async loadPluginPermissions(plugin) {\n    const permissions = {\n      agents: [],\n      commands: [],\n      hooks: [],\n      mcps: []\n    };\n\n    try {\n      // Load plugin agents\n      const agentsDir = path.join(plugin.path, 'agents');\n      if (await fs.pathExists(agentsDir)) {\n        const agentFiles = await fs.readdir(agentsDir);","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/plugin-dashboard.js#L441-L477","documentation":"loadUserPermissions reads the user-level Claude Code settings to extract which components the user has explicitly allowed, warning and returning partial/empty results if reading or parsing fails. Like the other dashboard warnings, it is non-fatal: the dashboard continues but the user-permissions view will be incomplete.","triggerScenarios":"Calling loadUserPermissions when ~/.claude/settings.json (or the configured user settings path) is unreadable or invalid JSON, or when fields like permissions.agents/commands/hooks/mcps have unexpected types that break the spread/push logic.","commonSituations":"Malformed user settings.json from manual editing; settings file truncated by a crash during write; HOME unset or pointing somewhere unexpected in CI/containers so the settings path resolves oddly; schema drift after a Claude Code upgrade.","solutions":["Run `jq . ~/.claude/settings.json` to verify the file parses","Repair the JSON (or remove the file to let Claude Code regenerate defaults) and re-run the dashboard","Confirm HOME is set correctly in headless/CI environments","Keep permissions entries as arrays of strings to match the expected schema"],"exampleFix":"// before\n// ~/.claude/settings.json: { \"permissions\": { \"mcps\": null } }\n// after\n{ \"permissions\": { \"mcps\": [] } }","handlingStrategy":"validation","validationCode":"const fs = require('fs-extra');\nasync function userSettingsReadable(settingsPath) {\n  if (!(await fs.pathExists(settingsPath))) return false;\n  try { JSON.parse(await fs.readFile(settingsPath, 'utf8')); return true; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"catch (error) {\n  console.warn(`User permissions unavailable (${error.message}); continuing with empty set`);\n  return permissions;\n}","preventionTips":["Verify HOME is set in CI/containers before running the dashboard","Lint ~/.claude/settings.json after any manual edit","Let Claude Code regenerate the file rather than hand-restoring partial copies"],"tags":["settings-json","json-parse","permissions","user-config"],"backgroundTag":"settings-json-invalid","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}