openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
18 lines (17 loc) • 1.46 kB
JavaScript
import { i as extractErrorCode, n as collectErrorGraphCandidates, s as readErrorCauses } from "./error-coercion-CvJK4lmH.mjs";
import { t as formatErrorMessage } from "./errors-O33D01XW.mjs";
import { n as formatSqliteErrorCodeSuffix } from "./sqlite-error-diagnostics-DCvjvszg.mjs";
//#region src/infra/gateway-lock-diagnostics.ts
/** Keep acquisition failures distinct from contention when Doctor records a refusal. */
function formatGatewayLockFailure(error) {
const causes = collectErrorGraphCandidates(error, readErrorCauses);
const codes = new Set(causes.map(extractErrorCode));
let guidance = "";
if (codes.has("EACCES") || codes.has("EPERM")) guidance = "Check ownership and write permissions for the reported lock path under the OpenClaw user; containers need a writable state mount.";
else if (codes.has("ENOSPC")) guidance = "Free space or inodes on the filesystem containing the reported lock path, then retry.";
else if (codes.has("ENOSYS")) guidance = "The required filesystem operation is unavailable. Upgrade OpenClaw and the container host/kernel, then retry.";
else if (codes.has("ENOTSUP") || codes.has("EOPNOTSUPP")) guidance = "Stop OpenClaw, back up the state directory, and use a local filesystem that supports exclusive file creation for state ownership.";
return `${formatErrorMessage(error)}${formatSqliteErrorCodeSuffix(error)}${guidance ? `. ${guidance}` : ""}`;
}
//#endregion
export { formatGatewayLockFailure as t };