{"record":{"id":"5929306ec67f5c9e","repo":"EveryInc/compound-engineering-plugin","slug":"could-not-inspect-configpath-error-instanceo","errorCode":null,"errorMessage":"Could not inspect ${configPath}: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Could not inspect (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/dev/codex-dev.ts","lineNumber":470,"sourceCode":"  runner: CommandRunner,\n): Promise<InstalledPlugin[]> {\n  const result = await runCodex(context, runner, [\"plugin\", \"list\", \"--available\", \"--json\"])\n  const payload = parseJson<{ installed?: InstalledPlugin[] }>(result, \"codex plugin list\")\n  return (payload.installed ?? []).filter(\n    (entry) => entry.name === \"compound-engineering\" || entry.pluginId.startsWith(\"compound-engineering@\"),\n  )\n}\n\nasync function isOfficialPluginConfigured(context: CodexDevContext): Promise<boolean> {\n  const configPath = path.join(context.codexHome, \"config.toml\")\n  try {\n    const config = Bun.TOML.parse(await fs.readFile(configPath, \"utf8\")) as {\n      plugins?: Record<string, { enabled?: unknown }>\n    }\n    return config.plugins?.[OFFICIAL_PLUGIN_ID]?.enabled === true\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return false\n    throw new Error(\n      `Could not inspect ${configPath}: ${error instanceof Error ? error.message : String(error)}`,\n    )\n  }\n}\n\nfunction normalizedGitUrl(value: string | undefined): string | undefined {\n  return value?.replace(/\\.git\\/?$/, \"\").replace(/\\/$/, \"\").toLowerCase()\n}\n\nfunction isOfficialMarketplacePlugin(plugin: InstalledPlugin): boolean {\n  const pluginSourceIsOfficial =\n    plugin.source?.source === \"local\" ||\n    (plugin.source?.source === \"git\" &&\n      normalizedGitUrl(plugin.source.url) === normalizedGitUrl(OFFICIAL_REPOSITORY))\n  return (\n    plugin.pluginId === OFFICIAL_PLUGIN_ID &&\n    plugin.installed === true &&\n    plugin.enabled === true &&","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/dev/codex-dev.ts#L452-L488","documentation":"isOfficialPluginConfigured() reads the Codex config.toml and checks whether the official plugin is enabled. ENOENT (no config file) is treated as 'not configured'; any other read or TOML-parse failure is wrapped in this labeled error so the caller knows the config could not be inspected.","triggerScenarios":"Reading configPath fails for reasons other than ENOENT: EACCES (permission denied), EISDIR (configPath is a directory), or Bun.TOML.parse throws on malformed TOML.","commonSituations":"Partially-written or hand-edited config.toml with TOML syntax errors; restrictive file permissions after copying CODEX_HOME from another user; a stale $CODEX_HOME pointing at a directory where config.toml is actually a folder.","solutions":["Run `bunx tappy` or a TOML linter on $CODEX_HOME/config.toml and fix syntax errors","Check permissions: `ls -la $CODEX_HOME/config.toml` (readable by current user, not a directory)","Verify $CODEX_HOME points at the real Codex config directory","If the file is corrupt beyond repair, restore it from backup or let codex regenerate it"],"exampleFix":"# before (config.toml has a TOML error)\n$ bun run codex:dev -- status\n// Error: Could not inspect /home/u/.codex/config.toml: Expected '=', found 'plugins'\n\n# after\n$ cat ~/.codex/config.toml   # find the bad line\n# fix it, e.g.\n// before: [plugins\n// after:  [plugins]\n$ bun run codex:dev -- status","handlingStrategy":"try-catch","validationCode":"const cfg = path.join(codexHome, \"config.toml\");\nconst stat = await fs.lstat(cfg);            // throws ENOENT/EACCES early\nif (!stat.isFile()) throw new Error(`${cfg} is not a regular file`);\nBun.TOML.parse(await fs.readFile(cfg, \"utf8\")); // validate TOML before calling the lib","typeGuard":"function isErrnoException(e: unknown): e is NodeJS.ErrnoException {\n  return e instanceof Error && typeof (e as NodeJS.ErrnoException).code === \"string\";\n}","tryCatchPattern":"try {\n  await removeLocalPluginConflicts(context, runner, plugins);\n} catch (e) {\n  if (String(e).startsWith(\"Could not inspect\")) {\n    console.error(\"config.toml unreadable or invalid TOML — fix or restore it, then retry\");\n  } else throw e;\n}","preventionTips":["Validate config.toml with a TOML parser after hand edits","Keep config.toml owned and readable by the current user","Verify $CODEX_HOME points at the actual Codex config directory"],"tags":["toml","config","filesystem","permissions","codex-dev"],"backgroundTag":"config-parse-error","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}