TencentCloud/TencentDB-Agent-Memory · warning

Cannot locate openclaw.json — please add hooks.allowConversa

Error message

Cannot locate openclaw.json — please add hooks.allowConversationAccess manually

What it means

manualPatch is the fallback writer for the plugin's hook policy: when the SDK's mutateConfigFile is unavailable or failed, it edits openclaw.json directly to set plugins.entries.<pluginId>.hooks.allowConversationAccess = true. This warning is logged — and patching aborted — when resolveConfigPath() cannot find the openclaw.json config file anywhere it looks, so the user must add the policy by hand.

Source

Thrown at MemoryCore/src/utils/ensure-hook-policy.ts:224

    }).then(() => {
      logger.info(`${TAG} ✅ Patched via SDK — gateway will restart automatically.`);
    }).catch((err: unknown) => {
      logger.warn(`${TAG} SDK mutateConfigFile failed: ${err instanceof Error ? err.message : String(err)}, trying manual fallback...`);
      manualPatch(logger);
    });
    return;
  }

  // Fallback: manual file write
  manualPatch(logger);
}

function manualPatch(logger: Logger): void {
  const TAG = "[memory-tdai] [hook-policy]";

  const configPath = resolveConfigPath();
  if (!configPath) {
    logger.warn(`${TAG} Cannot locate openclaw.json — please add hooks.allowConversationAccess manually`);
    return;
  }

  let parsed: Record<string, unknown>;
  try {
    const raw = fs.readFileSync(configPath, "utf-8");
    parsed = JSON5.parse(raw);
  } catch {
    logger.warn(`${TAG} Failed to parse ${configPath} — please add hooks.allowConversationAccess manually`);
    return;
  }

  if (hasPolicyAlready(parsed)) return;

  if ("$include" in parsed || (isObj(parsed.plugins) && "$include" in parsed.plugins)) {
    logger.warn(`${TAG} Config uses $include — please add manually: plugins.entries.${PLUGIN_ID}.hooks.allowConversationAccess = true`);
    return;
  }

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Create or locate openclaw.json in the gateway's config directory and ensure the process has read access.
  2. Manually add the policy: set plugins.entries."memory-tencentdb".hooks.allowConversationAccess = true in openclaw.json, then restart the gateway.
  3. Check that whatever mechanism resolveConfigPath() uses (env var / well-known paths) matches your install; set the config path explicitly if supported.
  4. Prefer fixing the SDK path — ensure the host provides runtimeConfig.mutateConfigFile so the manual fallback is never needed.
  5. If running outside a gateway (tests, CLI), ignore: ensurePluginHookPolicy only acts on gateway start, and this warning is benign there.

Example fix

// before: openclaw.json missing the policy
{
  "plugins": { "entries": { "memory-tencentdb": {} } }
}
// after: add it manually when auto-patch cannot find the file
{
  "plugins": {
    "entries": {
      "memory-tencentdb": {
        "hooks": { "allowConversationAccess": true }
      }
    }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

import fs from "node:fs";
const candidates = [
  process.env.OPENCLAW_CONFIG_PATH,
  "./openclaw.json",
  "~/.openclaw/openclaw.json",
].filter(Boolean) as string[];
const found = candidates.find((p) => fs.existsSync(p));
if (!found) {
  console.warn("openclaw.json not found — add plugins.entries.<id>.hooks.allowConversationAccess = true manually");
}

Try / catch

try {
  ensurePluginHookPolicy({ rootConfig, runtimeConfig, logger });
} catch (err) {
  logger.warn(`hook policy check failed: ${err instanceof Error ? err.message : err} — verify hooks.allowConversationAccess in openclaw.json`);
}

Prevention

When it happens

Trigger: ensurePluginHookPolicy detects the policy is missing, the SDK mutateConfigFile path is absent or rejects (falling through to manualPatch), and resolveConfigPath() returns null because openclaw.json does not exist in the expected locations (e.g. running outside a real OpenClaw gateway workspace, custom OPENCLAW_CONFIG_PATH-style env not set, or the config file was renamed/deleted).

Common situations: Running the plugin in a non-standard install directory where the gateway config lives elsewhere; fresh machine without openclaw.json yet; CI/container where the home/config directory is not mounted; config split via $include so the resolver skips it (a related but distinct warning).

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/dbe3b6559d550a9c. Report an issue: GitHub.