multica-ai/multica · error · ApiError

API error: ${res.status} ${res.statusText}

Error message

API error: ${res.status} ${res.statusText}

What it means

Wrap thrown by prepareHermesHome when prepareHermesTaskLocalState fails. That helper prepares the parts of the per-task overlay that must be task-local (state that must not leak across tasks, e.g. task-local session/database scaffolding) inside hermes-home; a failure there means the overlay's isolation contract cannot be established, so prepare fails closed.

Source

Thrown at packages/core/api/client.ts:636

      ...this.authHeaders(),
      ...(init?.extraHeaders ?? {}),
      ...((init?.headers as Record<string, string>) ?? {}),
    };

    this.logger.info(`→ ${method} ${path}`, { rid });

    const res = await fetch(`${this.baseUrl}${path}`, {
      ...init,
      headers,
      credentials: "include",
    });

    if (!res.ok) {
      if (res.status === 401) this.handleUnauthorized();
      const { message, body } = await this.parseErrorBody(res, `API error: ${res.status} ${res.statusText}`);
      const logLevel = res.status === 404 ? "warn" : "error";
      this.logger[logLevel](`← ${res.status} ${path}`, { rid, duration: `${Date.now() - start}ms`, error: message });
      throw new ApiError(message, res.status, res.statusText, body);
    }

    this.logger.info(`← ${res.status} ${path}`, { rid, duration: `${Date.now() - start}ms` });
    return res;
  }

  private async fetch<T>(path: string, init?: RequestInit): Promise<T> {
    const res = await this.fetchRaw(path, {
      ...init,
      extraHeaders: { "Content-Type": "application/json" },
    });
    // Handle 204 No Content
    if (res.status === 204) {
      return undefined as T;
    }
    return res.json() as Promise<T>;
  }

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Read the wrapped error for the exact operation and path, then fix ownership/permissions of the hermes-home tree for the daemon user.
  2. Delete the stale per-task env-root so prepare rebuilds the overlay from scratch.
  3. Free space / remount read-write and retry.
Defensive patterns

Strategy: try-catch

Try / catch

if err := prepareHermesHome(...); err != nil {
    if strings.Contains(err.Error(), "prepare task-local state") {
        // wrapped fs error: repair hermes-home ownership or wipe the per-task env-root, retry prepare
    }
}

Prevention

When it happens

Trigger: prepareHermesTaskLocalState cannot create/remove/permission the task-local state files under <hermes-home> — write or mkdir errors from permission mismatch, full disk, or stale files owned by another user.

Common situations: Same env-root recycled across daemon users; a partially-written overlay from a crashed previous run; read-only or full env-root volume.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/7bae50ae30599d51. Report an issue: GitHub.