different-ai/openwork · error

mcp.config_load_failed

mcp.config_load_failed

Error message

t("mcp.config_load_failed")

What it means

The "reveal MCP config file" action resolves the config file path either via props.readConfigFile or by reading the local opencode config. If resolution yields null (no config file could be located or read for the given scope), it throws the localized "mcp.config_load_failed" instead of attempting to open a nonexistent path.

Source

Thrown at apps/app/src/react-app/domains/settings/pages/mcp-view.tsx:952

    if (!isDesktopRuntime() || revealBusy) return;
    const root = props.selectedWorkspaceRoot.trim();

    if (configScope === "project" && !root) {
      setConfigError(t("mcp.pick_workspace_error"));
      return;
    }

    setRevealBusy(true);
    setConfigError(null);
    try {
      const resolved = props.readConfigFile
        ? await props.readConfigFile(configScope)
        : !props.isRemoteWorkspace
        ? await readOpencodeConfig(configScope, root)
        : null;
      const configFile = resolved as OpencodeConfigFile | null;
      if (!configFile) {
        throw new Error(t("mcp.config_load_failed"));
      }
      if (isWindowsPlatform()) {
        await openDesktopPath(configFile.path);
      } else {
        await revealDesktopItemInDir(configFile.path);
      }
    } catch (error) {
      setConfigError(
        error instanceof Error ? error.message : t("mcp.reveal_config_failed"),
      );
    } finally {
      setRevealBusy(false);
    }
  };

  const detailPanels = (
    <>
      {detailEntry ? (() => {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Create an opencode config file (e.g. opencode.json) for the scope, then retry
  2. Check the scope is correct (project vs. global) and the file exists on disk
  3. Verify read permissions on the config directory

Example fix

// before
await readOpencodeConfig(scope, root); // null if missing
// after
await writeFile(configPath, "{}\n");
await readOpencodeConfig(scope, root);
Defensive patterns

Strategy: try-catch

Validate before calling

const resolved = scope ? await props.readConfigFile(scope) : await readOpencodeConfig(scope, root);
if (!resolved) {
  showToast(t("mcp.config_load_failed"));
  return;
}

Type guard

const isConfigFile = (f: unknown): f is OpencodeConfigFile =>
  f != null && typeof (f as OpencodeConfigFile).path === "string";

Try / catch

try {
  await openConfigFile(configScope);
} catch (e) {
  if ((e as Error).message.includes("config_load_failed")) showCreateConfigHint();
  else throw e;
}

Prevention

When it happens

Trigger: Clicking to open/reveal the MCP config file when no opencode config file exists for the scope, the file read fails, or a remote workspace has no local config to read.

Common situations: Fresh install with no opencode.json yet; remote workspace where reveal is not supported; scope pointing at a missing project config; filesystem permission errors.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/2b9900ec1cc3eb9b. Report an issue: GitHub.