rohitg00/agentmemory · warning
observe failed for ${obs.toolName}: ${res.status} ${res.stat
Error message
observe failed for ${obs.toolName}: ${res.status} ${res.statusText}${body ? ` — ${body.slice(0, 160)}` : ""} What it means
The CLI's observe flow POSTs tool observations to the daemon's REST API; when the response status is not ok, it logs 'observe failed for <toolName>: <status> <statusText> — <body excerpt>' via p.log.warn. The daemon answered, but rejected or errored on the observation (e.g. 400 bad payload, 401 bad secret, 404 wrong route/version mismatch). Non-fatal: the session continues and only session/end uses strict POST.
Source
Thrown at src/cli.ts:2889
};
try {
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
signal: AbortSignal.timeout(5000),
});
if (res.ok) {
stored++;
} else {
const body = await res.text().catch(() => "");
p.log.warn(
`observe failed for ${obs.toolName}: ${res.status} ${res.statusText}${body ? ` — ${body.slice(0, 160)}` : ""}`,
);
}
} catch (err) {
p.log.warn(
`observe request failed for ${obs.toolName}: ${err instanceof Error ? err.message : String(err)}`,
);
}
}
await postJsonStrict(`${base}/agentmemory/session/end`, { sessionId: session.id });
return stored;
}
async function runDemoSearch(base: string, query: string): Promise<SearchResult> {
const data = await postJson<{ results?: Array<{ title?: string }> }>(
`${base}/agentmemory/smart-search`,
{ query, limit: 5 },
10000,
);
const items = data?.results ?? [];
return {
query,View on GitHub (pinned to e04ba88819)
Solutions
- Read the status/body in the message: fix auth for 401 (align AGENTMEMORY_SECRET) or the payload for 400.
- Update the CLI to match the daemon version (npm update agentmemory) so the observe endpoint exists.
- Check the daemon is the real agentmemory server, not another service answering on that port (an HTML body hints at a proxy).
- Retry manually with curl -H "Authorization: Bearer $AGENTMEMORY_SECRET" to the observe endpoint to see the full error.
Example fix
// before: stale secret on CLI // observe failed for Bash: 401 Unauthorized // after export AGENTMEMORY_SECRET=$(cat ~/.agentmemory/secret)
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(`${base}/agentmemory/session/observe`, {
method: "POST",
headers: { Authorization: `Bearer ${secret}`, "Content-Type": "application/json" },
body: JSON.stringify(obs),
});
if (!res.ok) console.warn(`pre-check failed: ${res.status} ${await res.text()}`); Try / catch
try {
const res = await postObservation(obs);
if (!res.ok) {
const body = await res.text().catch(() => "");
console.warn(`observe failed: ${res.status} ${body.slice(0,160)}`);
if (res.status === 401) fixSecret();
}
} catch (err) { /* network error — observation dropped, non-fatal */ } Prevention
- Keep CLI and daemon versions aligned; upgrade both together.
- Verify AGENTMEMORY_SECRET matches between CLI and daemon.
- Check daemon logs for the rejecting request to see the server-side reason.
- Remember observe failures are non-fatal by design; only session/end is strict.
When it happens
Trigger: A POST of a tool observation returns res.ok === false, typically 401 (wrong AGENTMEMORY_SECRET), 400 (payload fails REST field validation/whitelisting), or 404 (daemon version without the observe route).
Common situations: CLI and daemon version mismatch after an upgrade; mismatched AGENTMEMORY_SECRET between CLI and daemon; a proxy between them returning an error page body (which appears truncated in the message).
Related errors
- POST ${url} failed: ${res.status} ${res.statusText}${suffix}
- ${adapter.displayName}: guideline not written (${gerr instan
- agentmemory: could not locate bundled plugin/ directory (sea
- ${init?.method || "GET"} ${path} -> ${res.status} ${res.stat
- Cohere embedding failed (${response.status}): ${err}
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/808d81e4f8375a4a.
Report an issue: GitHub.