EveryInc/compound-engineering-plugin · error · Error

Could not inspect ${configPath}: ${error instanceof Error ?

Error message

Could not inspect ${configPath}: ${error instanceof Error ? error.message : String(error)}

What it means

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.

Source

Thrown at src/dev/codex-dev.ts:470

  runner: CommandRunner,
): Promise<InstalledPlugin[]> {
  const result = await runCodex(context, runner, ["plugin", "list", "--available", "--json"])
  const payload = parseJson<{ installed?: InstalledPlugin[] }>(result, "codex plugin list")
  return (payload.installed ?? []).filter(
    (entry) => entry.name === "compound-engineering" || entry.pluginId.startsWith("compound-engineering@"),
  )
}

async function isOfficialPluginConfigured(context: CodexDevContext): Promise<boolean> {
  const configPath = path.join(context.codexHome, "config.toml")
  try {
    const config = Bun.TOML.parse(await fs.readFile(configPath, "utf8")) as {
      plugins?: Record<string, { enabled?: unknown }>
    }
    return config.plugins?.[OFFICIAL_PLUGIN_ID]?.enabled === true
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code === "ENOENT") return false
    throw new Error(
      `Could not inspect ${configPath}: ${error instanceof Error ? error.message : String(error)}`,
    )
  }
}

function normalizedGitUrl(value: string | undefined): string | undefined {
  return value?.replace(/\.git\/?$/, "").replace(/\/$/, "").toLowerCase()
}

function isOfficialMarketplacePlugin(plugin: InstalledPlugin): boolean {
  const pluginSourceIsOfficial =
    plugin.source?.source === "local" ||
    (plugin.source?.source === "git" &&
      normalizedGitUrl(plugin.source.url) === normalizedGitUrl(OFFICIAL_REPOSITORY))
  return (
    plugin.pluginId === OFFICIAL_PLUGIN_ID &&
    plugin.installed === true &&
    plugin.enabled === true &&

View on GitHub (pinned to c9c10f8c75)

Solutions

  1. Run `bunx tappy` or a TOML linter on $CODEX_HOME/config.toml and fix syntax errors
  2. Check permissions: `ls -la $CODEX_HOME/config.toml` (readable by current user, not a directory)
  3. Verify $CODEX_HOME points at the real Codex config directory
  4. If the file is corrupt beyond repair, restore it from backup or let codex regenerate it

Example fix

# before (config.toml has a TOML error)
$ bun run codex:dev -- status
// Error: Could not inspect /home/u/.codex/config.toml: Expected '=', found 'plugins'

# after
$ cat ~/.codex/config.toml   # find the bad line
# fix it, e.g.
// before: [plugins
// after:  [plugins]
$ bun run codex:dev -- status
Defensive patterns

Strategy: try-catch

Validate before calling

const cfg = path.join(codexHome, "config.toml");
const stat = await fs.lstat(cfg);            // throws ENOENT/EACCES early
if (!stat.isFile()) throw new Error(`${cfg} is not a regular file`);
Bun.TOML.parse(await fs.readFile(cfg, "utf8")); // validate TOML before calling the lib

Type guard

function isErrnoException(e: unknown): e is NodeJS.ErrnoException {
  return e instanceof Error && typeof (e as NodeJS.ErrnoException).code === "string";
}

Try / catch

try {
  await removeLocalPluginConflicts(context, runner, plugins);
} catch (e) {
  if (String(e).startsWith("Could not inspect")) {
    console.error("config.toml unreadable or invalid TOML — fix or restore it, then retry");
  } else throw e;
}

Prevention

When it happens

Trigger: Reading configPath fails for reasons other than ENOENT: EACCES (permission denied), EISDIR (configPath is a directory), or Bun.TOML.parse throws on malformed TOML.

Common situations: 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.

Related errors


AI-assisted analysis of EveryInc/compound-engineering-plugin@c9c10f8c75 (2026-08-31). Data as JSON: /api/errors/5929306ec67f5c9e. Report an issue: GitHub.