TencentCloud/TencentDB-Agent-Memory · error
${TAG} ${path} fetch failed: ${(err as Error).message}
Error message
${TAG} ${path} fetch failed: ${(err as Error).message} What it means
MetaClient.fetch wraps the metadata-service HTTP POST; any exception thrown by fetch() itself (network error, DNS failure, timeout via AbortSignal.timeout) is rethrown with a prefixed message naming the path and underlying cause. This distinguishes transport-level failures from HTTP status and envelope errors, which have their own messages.
Source
Thrown at MemoryProxy/src/meta/client.ts:542
const headers: Record<string, string> = {
"Authorization": `Bearer ${this.serviceToken}`,
"x-tdai-service-id": this.serviceId,
"Content-Type": "application/json",
};
if (this.userKey) {
headers["x-tdai-user-key"] = this.userKey;
}
let resp: Response;
try {
resp = await this.fetcher(url, {
method: "POST",
headers,
body: JSON.stringify(body),
signal: AbortSignal.timeout(this.defaultTimeoutMs),
});
} catch (err) {
throw new Error(`${TAG} ${path} fetch failed: ${(err as Error).message}`);
}
if (!resp.ok) {
let detail = "";
try {
detail = await resp.text();
} catch { /* ignore */ }
console.log(
`[wb-debug] metadata-client req path=${path} status=${resp.status} url=${url} serviceId=${this.serviceId} userKey.len=${this.userKey?.length ?? 0} userKey.prefix=${(this.userKey ?? "").slice(0, 20)} serviceToken.len=${this.serviceToken?.length ?? 0} body.len=${detail.length} body.head=${detail.slice(0, 300)}`,
);
throw new Error(`${TAG} ${path} HTTP ${resp.status}${detail ? `: ${detail.slice(0, 200)}` : ""}`);
}
const env = (await resp.json()) as CoreEnvelope<T>;
if (env.code !== 0) {
throw new Error(`${TAG} ${path} envelope error ${env.code}: ${env.message ?? ""}`);
}View on GitHub (pinned to 3efcd317b8)
Solutions
- Confirm the metadata service URL is correct and reachable from the runtime (curl the endpoint)
- Increase defaultTimeoutMs if timeouts are the cause (AbortError in message)
- Check network egress/proxy/firewall rules for the deployment environment
- Retry with backoff for transient network errors; inspect the inner error message after 'fetch failed:' for the root cause
Example fix
// before
new MetaClient({ ..., defaultTimeoutMs: 3000 });
// after
new MetaClient({ ..., defaultTimeoutMs: 15000 }); // tolerate slow metadata service Defensive patterns
Strategy: retry
Validate before calling
// precheck connectivity
const reachable = await fetch(serviceUrl, { method: "HEAD", signal: AbortSignal.timeout(3000) }).then(() => true).catch(() => false);
if (!reachable) throw new Error("metadata service unreachable before request"); Try / catch
try {
await client.createTask(body);
} catch (e) {
if (/fetch failed:.*(TimeoutError|AbortError|ECONNRESET|ENOTFOUND)/i.test(e.message)) {
await backoffRetry(() => client.createTask(body), 3);
return;
}
throw e;
} Prevention
- Set defaultTimeoutMs generously for production networks
- Monitor metadata-service health and alert on DNS/egress failures
- Retry only transport-level failures (this error), not HTTP/envelope errors
- Inspect the inner message after 'fetch failed:' to classify the root cause
When it happens
Trigger: createTask/updateTask/appendParticipationLog calls fetch and the request rejects before a response is returned: connection refused/reset, DNS resolution failure, TLS error, or defaultTimeoutMs elapsing (AbortError/TimeoutError).
Common situations: Metadata service down or wrong URL configured; corporate proxy/firewall blocking egress; timeout too low for slow networks; service DNS not resolvable inside the deployment environment.
Related errors
- KernelFetchError(504 on timeout, 502 otherwise) with dynamic
- [instance-config] Config source returned empty VDB config fo
- [skill-agent-queue] tasks-mutex wait timeout for ${key}
- Embedding API returned unexpected format: missing 'data' arr
- task_not_found
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/35847651bb6951d4.
Report an issue: GitHub.